Collaborators: Shane Blowes, Jon Chase, Helmut Hillebrand, Michael Burrows, Amanda Bates, Uli Brose, Benoit Gauzens, Laura Antao Assistance: Katherine Lew, Josef Hauser
library(data.table) # for handling large datasets
library(ggplot2) # for some plotting
library(nlme) # for ME models
library(maps) # for map
library(gridExtra) # to combine ggplots together
library(grid) # to combine ggplots together
library(RColorBrewer)
options(width=500) # turn off most text wrapping
# tell RStudio to use project root directory as the root for this notebook. Needed since we are storing code in a separate directory.
knitr::opts_knit$set(root.dir = rprojroot::find_rstudio_root_file())
# Turnover and covariates assembled by turnover_vs_temperature_prep.Rmd
trends <- fread('output/turnover_w_covariates.csv.gz')
# set realm order
trends[, REALM := factor(REALM, levels = c('Freshwater', 'Marine', 'Terrestrial'), ordered = FALSE)]
# set up sign of temperature change
trends[, tsign := factor(sign(temptrend))]
# realm that combined Terrestrial and Freshwater, for interacting with human impact
trends[, REALM2 := REALM]
levels(trends$REALM2) = list(TerrFresh = "Freshwater", TerrFresh = "Terrestrial", Marine = "Marine")
# group Marine invertebrates/plants in with All
trends[, taxa_mod2 := taxa_mod]
trends[taxa_mod == 'Marine invertebrates/plants', taxa_mod2 := 'All']
trends[, tempave.sc := scale(tempave)]
trends[, tempave_metab.sc := scale(tempave_metab)]
trends[, seas.sc := scale(seas)]
trends[, microclim.sc := scale(log(microclim))]
trends[, temptrend.sc := scale(temptrend, center = FALSE)]
trends[, temptrend_abs.sc := scale(abs(temptrend), center = FALSE)] # do not center, so that 0 is still 0 temperature change
trends[, mass.sc := scale(log(mass_mean_weight))]
trends[, speed.sc := scale(log(speed_mean_weight+1))]
trends[, lifespan.sc := scale(log(lifespan_mean_weight))]
trends[, consumerfrac.sc := scale(consfrac)]
trends[, endothermfrac.sc := scale(endofrac)]
trends[, nspp.sc := scale(log(Nspp))]
trends[, thermal_bias.sc := scale(thermal_bias)]
trends[, npp.sc := scale(log(npp))]
trends[, veg.sc := scale(log(veg+1))]
trends[, human_bowler.sc := scale(log(human_bowler+1)), by = REALM2] # separate scaling by realm
trends[REALM2 == 'TerrFresh', human_footprint.sc := scale(log(human_venter+1))]
trends[REALM2 == 'Marine', human_footprint.sc := scale(log(human_halpern))]
Just turnover
cat('Overall # time-series: ', nrow(trends), '\n')
Overall # time-series: 53013
cat('# studies: ', trends[, length(unique(STUDY_ID))], '\n')
# studies: 332
cat('Data points: ', trends[, sum(nyrBT)], '\n')
Data points: 293973
trends[, table(REALM)]
REALM
Freshwater Marine Terrestrial
1025 48647 3341
trends[, table(taxa_mod)]
taxa_mod
All Amphibians Benthos
1705 379 4679
Birds Fish Invertebrates
13741 28473 2996
Mammals Marine invertebrates/plants Plant
525 206 305
Reptiles
4
trends[, table(taxa_mod, REALM)]
REALM
taxa_mod Freshwater Marine Terrestrial
All 0 1702 3
Amphibians 2 0 377
Benthos 0 4679 0
Birds 0 11099 2642
Fish 1006 27467 0
Invertebrates 15 2901 80
Mammals 0 478 47
Marine invertebrates/plants 0 206 0
Plant 1 115 189
Reptiles 1 0 3
With all covariates (Bowler for human)
# the cases we can compare
apply(trends[, .(Jtutrend, REALM, tempave.sc, tempave_metab.sc, seas.sc, microclim.sc, temptrend.sc, mass.sc, speed.sc, lifespan.sc, consumerfrac.sc, endothermfrac.sc, nspp.sc, thermal_bias.sc, npp.sc, veg.sc, human_bowler.sc)], MARGIN = 2, FUN = function(x) sum(!is.na(x)))
Jtutrend REALM tempave.sc tempave_metab.sc seas.sc
53013 53013 49916 49916 49916
microclim.sc temptrend.sc mass.sc speed.sc lifespan.sc
51834 49916 52820 52734 51540
consumerfrac.sc endothermfrac.sc nspp.sc thermal_bias.sc npp.sc
47534 53013 53013 49371 52863
veg.sc human_bowler.sc
52890 53013
i <- trends[, complete.cases(Jtutrend, tempave.sc, tempave_metab.sc, seas.sc, microclim.sc, temptrend.sc, mass.sc, speed.sc, lifespan.sc, consumerfrac.sc, endothermfrac.sc, nspp.sc, thermal_bias.sc, npp.sc, veg.sc, human_bowler.sc)]
cat('Overall # time-series: ', sum(i), '\n')
Overall # time-series: 43493
cat('# studies: ', trends[i, length(unique(STUDY_ID))], '\n')
# studies: 235
cat('Data points: ', trends[i, sum(nyrBT)], '\n')
Data points: 221956
trends[i, table(REALM)]
REALM
Freshwater Marine Terrestrial
978 39738 2777
trends[i, table(taxa_mod)]
taxa_mod
All Amphibians Benthos Birds Fish Invertebrates Mammals
521 12 590 11753 27345 2559 515
Plant Reptiles
196 2
trends[i, table(taxa_mod, REALM)]
REALM
taxa_mod Freshwater Marine Terrestrial
All 0 520 1
Amphibians 2 0 10
Benthos 0 590 0
Birds 0 9221 2532
Fish 966 26379 0
Invertebrates 9 2484 66
Mammals 0 477 38
Plant 1 67 128
Reptiles 0 0 2
Try combinations of
And choose the one with lowest AIC (not run: takes a long time)
# fit models for variance structure
fixed <- formula(Jtutrend ~ REALM + tempave_metab.sc + seas.sc + microclim.sc + npp.sc + temptrend_abs.sc +
mass.sc + speed.sc + lifespan.sc + consumerfrac.sc + thermal_bias.sc)
i <- trends[, complete.cases(Jtutrend, REALM, tempave_metab.sc, seas.sc, microclim.sc, npp.sc, temptrend_abs.sc,
mass.sc, speed.sc, lifespan.sc, consumerfrac.sc, thermal_bias.sc)]
mods <- vector('list', 0)
mods[[1]] <- gls(fixed, data = trends[i,])
mods[[2]] <- gls(fixed, data = trends[i,], weights = varPower(-0.5, ~nyrBT))
mods[[3]] <- gls(fixed, data = trends[i,], weights = varPower(0.5, ~ abs(temptrend)))
mods[[4]] <- lme(fixed, data = trends[i,], random = ~1|taxa_mod2, control = lmeControl(opt = "optim"))
mods[[5]] <- lme(fixed, data = trends[i,], random = ~1|STUDY_ID, control = lmeControl(opt = "optim"))
mods[[6]] <- lme(fixed, data = trends[i,], random = ~1|taxa_mod2/STUDY_ID, control = lmeControl(opt = "optim"))
mods[[7]] <- lme(fixed, data = trends[i,], random = ~1|STUDY_ID/rarefyID, control = lmeControl(opt = "optim"))
mods[[8]] <- lme(fixed, data = trends[i,], random = ~1|taxa_mod2/STUDY_ID/rarefyID, control = lmeControl(opt = "optim"))
mods[[9]] <- lme(fixed, data = trends[i,], random = ~temptrend_abs.sc | taxa_mod)
mods[[10]] <- lme(fixed, data = trends[i,], random = ~temptrend_abs.sc | STUDY_ID)
mods[[11]] <- lme(fixed, data = trends[i,], random = ~temptrend_abs.sc | taxa_mod2/STUDY_ID, control = lmeControl(opt = "optim"))
mods[[12]] <- lme(fixed, data = trends[i,], random = list(STUDY_ID = ~ temptrend_abs.sc, rarefyID = ~1)) # includes overdispersion. new formula so that random slope is only for study level (not enough data to extend to rarefyID).
mods[[13]] <- lme(fixed, data = trends[i,], random = list(taxa_mod2 = ~ temptrend_abs.sc, STUDY_ID = ~ temptrend_abs.sc, rarefyID = ~1)) # 30+ min to fit
mods[[14]] <- lme(fixed, data = trends[i,], random = ~1|STUDY_ID, weights = varPower(-0.5, ~nyrBT))
mods[[15]] <- lme(fixed, data = trends[i,], random = ~1|taxa_mod2, weights = varPower(-0.5, ~nyrBT))
mods[[16]] <- lme(fixed, data = trends[i,], random = ~1|taxa_mod2/STUDY_ID, weights = varPower(-0.5, ~nyrBT))
mods[[17]] <- lme(fixed, data = trends[i,], random = ~1|STUDY_ID/rarefyID, weights = varPower(-0.5, ~nyrBT))
mods[[18]] <- lme(fixed, data = trends[i,], random = ~1|taxa_mod2/STUDY_ID/rarefyID, weights = varPower(-0.5, ~nyrBT))
mods[[19]] <- lme(fixed, data = trends[i,], random = ~temptrend_abs.sc|STUDY_ID, weights = varPower(-0.5, ~nyrBT))
mods[[20]] <- lme(fixed, data = trends[i,], random = list(STUDY_ID = ~ temptrend_abs.sc, rarefyID = ~1), weights = varPower(-0.5, ~nyrBT))
mods[[21]] <- lme(fixed, data = trends[i,], random = list(taxa_mod2 = ~ temptrend_abs.sc, STUDY_ID = ~ 1), weights = varPower(-0.5, ~nyrBT))
mods[[22]] <- lme(fixed, data = trends[i,], random = list(taxa_mod2 = ~ temptrend_abs.sc, STUDY_ID = ~ 1, rarefyID = ~1), weights = varPower(-0.5, ~nyrBT))
mods[[23]] <- lme(fixed, data = trends[i,], random = list(taxa_mod2 = ~ temptrend_abs.sc, STUDY_ID = ~ temptrend_abs.sc), weights = varPower(-0.5, ~nyrBT)) # singular precision warning with lmeControl(opt = 'optim') and convergence error without
mods[[24]] <- lme(fixed, data = trends[i,], random = list(taxa_mod2 = ~ temptrend_abs.sc, STUDY_ID = ~ temptrend_abs.sc, rarefyID = ~1), weights = varPower(-0.5, ~nyrBT)) # singular precision warning with lmeControl(opt = 'optim') and convergence error without
mods[[25]] <- lme(fixed, data = trends[i,], random = ~1|taxa_mod2, weights = varPower(-0.5, ~abs(temptrend)))
mods[[26]] <- lme(fixed, data = trends[i,], random = ~1|STUDY_ID, weights = varPower(-0.5, ~abs(temptrend)))
mods[[27]] <- lme(fixed, data = trends[i,], random = ~1|STUDY_ID/rarefyID, weights = varPower(-0.5, ~abs(temptrend)))
mods[[28]] <- lme(fixed, data = trends[i,], random = ~1|taxa_mod2/STUDY_ID/rarefyID, weights = varPower(-0.5, ~abs(temptrend)))
mods[[29]] <- lme(fixed, data = trends[i,], random = ~temptrend_abs.sc|STUDY_ID, weights = varPower(-0.5, ~abs(temptrend)))
mods[[30]] <- lme(fixed, data = trends[i,], random = ~temptrend_abs.sc|taxa_mod2/STUDY_ID, weights = varPower(-0.5, ~abs(temptrend)), control = lmeControl(opt = "optim"))
mods[[31]] <- lme(fixed, data = trends[i,], random = list(STUDY_ID = ~ temptrend_abs.sc, rarefyID = ~1), weights = varPower(-0.5, ~abs(temptrend)))
mods[[32]] <- lme(fixed, data = trends[i,], random = list(taxa_mod2 = ~ temptrend_abs.sc, STUDY_ID = ~ temptrend_abs.sc, rarefyID = ~1), weights = varPower(-0.5, ~abs(temptrend)), control = lmeControl(opt = "optim")) # singular precision warning
aics <- sapply(mods, AIC)
minaics <- aics - min(aics)
minaics
which.min(aics)
Chooses the random slopes (temptrend_abs) & intercepts for STUDY_ID, overdispersion, and variance scaled to number of years. We haven’t dealt with potential testing on the boundary issues here yet.
world <- map_data('world')
ggplot(world, aes(x = long, y = lat, group = group)) +
geom_polygon(fill = 'lightgray', color = 'white') +
geom_point(data = trends, aes(rarefyID_x, rarefyID_y, group = REALM, color = REALM), size = 0.5, alpha = 0.4) +
scale_color_brewer(palette="Set1", name = 'Realm') +
theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(),
panel.background = element_blank(), axis.line = element_line(colour = "black"),
legend.key=element_blank(),
axis.text=element_text(size=16),
axis.title=element_text(size=20)) +
labs(x = 'Longitude (°)', y = 'Latitude (°)')
Mostly northern hemisphere, but spread all over. No so much in Africa or much of Asia.
Average rates of turnover (with year 1)
trends[abs(temptrend) >= 0.5, .(ave = mean(Jtutrend), sd = sd(Jtutrend)/sqrt(.N))] # turnover per year for locations changing temperature
trends[abs(temptrend) < 0.1, .(ave = mean(Jtutrend), sd = sd(Jtutrend)/sqrt(.N))] # not changing temperature
trends[temptrend >= 0.5, .(ave = mean(Jtutrend), sd = sd(Jtutrend)/sqrt(.N))] # warming
trends[temptrend <= -0.5, .(ave = mean(Jtutrend), sd = sd(Jtutrend)/sqrt(.N))] # cooling
trends[abs(temptrend) >= 0.5 & abs(rarefyID_y) < 35, .(ave = mean(Jtutrend), sd = sd(Jtutrend)/sqrt(.N))] # tropics and sub-tropics
trends[abs(temptrend) >= 0.5 & abs(rarefyID_y) >= 35 & abs(rarefyID_y) < 66.56339, .(ave = mean(Jtutrend), sd = sd(Jtutrend)/sqrt(.N))] # temperate
trends[abs(temptrend) >= 0.5 & abs(rarefyID_y) >= 66.56339, .(ave = mean(Jtutrend), sd = sd(Jtutrend)/sqrt(.N))] # arctic
Average rates of turnover (without year 1)
trends[abs(temptrend) >= 0.5, .(ave = mean(Jtutrendrem0, na.rm=TRUE),
sd = sd(Jtutrendrem0, na.rm=TRUE)/sqrt(.N))] # turnover per year for locations changing temperature
trends[abs(temptrend) < 0.1, .(ave = mean(Jtutrendrem0, na.rm=TRUE),
sd = sd(Jtutrendrem0, na.rm=TRUE)/sqrt(.N))] # not changing temperature
trends[temptrend >= 0.5, .(ave = mean(Jtutrendrem0, na.rm=TRUE),
sd = sd(Jtutrendrem0, na.rm=TRUE)/sqrt(.N))] # warming
trends[temptrend <= -0.5, .(ave = mean(Jtutrendrem0, na.rm=TRUE),
sd = sd(Jtutrendrem0, na.rm=TRUE)/sqrt(.N))] # cooling
trends[abs(temptrend) >= 0.5 & abs(rarefyID_y) < 35,
.(ave = mean(Jtutrendrem0, na.rm=TRUE),
sd = sd(Jtutrendrem0, na.rm=TRUE)/sqrt(.N))] # tropics and sub-tropics
trends[abs(temptrend) >= 0.5 & abs(rarefyID_y) >= 35 & abs(rarefyID_y) < 66.56339,
.(ave = mean(Jtutrendrem0, na.rm=TRUE),
sd = sd(Jtutrendrem0, na.rm=TRUE)/sqrt(.N))] # temperate
trends[abs(temptrend) >= 0.5 & abs(rarefyID_y) >= 66.56339,
.(ave = mean(Jtutrendrem0, na.rm=TRUE),
sd = sd(Jtutrendrem0, na.rm=TRUE)/sqrt(.N))] # arctic
i <- trends[, complete.cases(Jtutrend, REALM, temptrend)]
randef <- list(STUDY_ID = ~ abs(temptrend), rarefyID = ~1)
varef <- varPower(-0.5, ~nyrBT)
if(file.exists('temp/modonlyTtrend.rds')){
modonlyTtrend <- readRDS('temp/modonlyTtrend.rds')
} else {
modonlyTtrend <- lme(Jtutrend ~ abs(temptrend)*REALM,
random = randef, weights = varef, data = trends[i,], method = 'REML')
saveRDS(modonlyTtrend, file = 'temp/modonlyTtrend.rds')
}
i2 <- trends[, complete.cases(Jbetatrend, REALM, temptrend)]
if(file.exists('temp/modonlyTtrendJbeta.rds')){
modonlyTtrendJbeta <- readRDS('temp/modonlyTtrendJbeta.rds')
} else {
modonlyTtrendJbeta <- lme(Jbetatrend ~ abs(temptrend)*REALM,
random = randef, weights = varef, data = trends[i2,], method = 'REML',
control=lmeControl(msMaxIter = 100, maxIter = 100))
saveRDS(modonlyTtrendJbeta, file = 'temp/modonlyTtrendJbeta.rds')
}
i3 <- trends[, complete.cases(Horntrend, REALM, temptrend)]
if(file.exists('temp/modonlyTtrendHorn.rds')){
modonlyTtrendHorn <- readRDS('temp/modonlyTtrendHorn.rds')
} else {
modonlyTtrendHorn <- lme(Horntrend ~ abs(temptrend)*REALM,
random = randef, weights = varef, data = trends[i3,], method = 'REML')
saveRDS(modonlyTtrendHorn, file = 'temp/modonlyTtrendHorn.rds')
}
summary(modonlyTtrend)
Linear mixed-effects model fit by REML
Data: trends[i, ]
Random effects:
Formula: ~abs(temptrend) | STUDY_ID
Structure: General positive-definite, Log-Cholesky parametrization
StdDev Corr
(Intercept) 0.04375688 (Intr)
abs(temptrend) 0.29351811 -0.123
Formula: ~1 | rarefyID %in% STUDY_ID
(Intercept) Residual
StdDev: 0.001792571 0.2893301
Variance function:
Structure: Power of variance covariate
Formula: ~nyrBT
Parameter estimates:
power
-1.223838
Fixed effects: Jtutrend ~ abs(temptrend) * REALM
Correlation:
(Intr) abs(t) REALMM REALMT a():REALMM
abs(temptrend) -0.424
REALMMarine -0.934 0.396
REALMTerrestrial -0.923 0.391 0.862
abs(temptrend):REALMMarine 0.407 -0.960 -0.407 -0.375
abs(temptrend):REALMTerrestrial 0.387 -0.913 -0.362 -0.433 0.876
Standardized Within-Group Residuals:
Min Q1 Med Q3 Max
-8.38476416 -0.29781039 0.08738927 0.54929160 6.52538535
Number of Observations: 49916
Number of Groups:
STUDY_ID rarefyID %in% STUDY_ID
317 49916
summary(modonlyTtrendJbeta)
Linear mixed-effects model fit by REML
Data: trends[i2, ]
Random effects:
Formula: ~abs(temptrend) | STUDY_ID
Structure: General positive-definite, Log-Cholesky parametrization
StdDev Corr
(Intercept) 0.05691594 (Intr)
abs(temptrend) 0.34739161 -0.16
Formula: ~1 | rarefyID %in% STUDY_ID
(Intercept) Residual
StdDev: 1.28009e-06 0.3525846
Variance function:
Structure: Power of variance covariate
Formula: ~nyrBT
Parameter estimates:
power
-1.394679
Fixed effects: Jbetatrend ~ abs(temptrend) * REALM
Correlation:
(Intr) abs(t) REALMM REALMT a():REALMM
abs(temptrend) -0.428
REALMMarine -0.933 0.399
REALMTerrestrial -0.926 0.396 0.864
abs(temptrend):REALMMarine 0.411 -0.961 -0.411 -0.380
abs(temptrend):REALMTerrestrial 0.390 -0.913 -0.364 -0.437 0.877
Standardized Within-Group Residuals:
Min Q1 Med Q3 Max
-7.3578768 -0.1587203 0.2033006 0.6705745 6.5270460
Number of Observations: 49916
Number of Groups:
STUDY_ID rarefyID %in% STUDY_ID
317 49916
summary(modonlyTtrendHorn)
Linear mixed-effects model fit by REML
Data: trends[i3, ]
Random effects:
Formula: ~abs(temptrend) | STUDY_ID
Structure: General positive-definite, Log-Cholesky parametrization
StdDev Corr
(Intercept) 0.0549979 (Intr)
abs(temptrend) 0.3228314 -0.095
Formula: ~1 | rarefyID %in% STUDY_ID
(Intercept) Residual
StdDev: 0.007989212 0.3034899
Variance function:
Structure: Power of variance covariate
Formula: ~nyrBT
Parameter estimates:
power
-1.217439
Fixed effects: Horntrend ~ abs(temptrend) * REALM
Correlation:
(Intr) abs(t) REALMM REALMT a():REALMM
abs(temptrend) -0.399
REALMMarine -0.921 0.368
REALMTerrestrial -0.919 0.367 0.847
abs(temptrend):REALMMarine 0.381 -0.954 -0.378 -0.350
abs(temptrend):REALMTerrestrial 0.363 -0.908 -0.334 -0.408 0.867
Standardized Within-Group Residuals:
Min Q1 Med Q3 Max
-6.21250285 -0.32193926 0.06521414 0.53688251 6.03752738
Number of Observations: 48800
Number of Groups:
STUDY_ID rarefyID %in% STUDY_ID
276 48800
i4 <- trends[, complete.cases(Jtutrendrem0, REALM, temptrend)]
randef <- list(STUDY_ID = ~ abs(temptrend), rarefyID = ~1)
varef <- varPower(-0.5, ~nyrBT)
if(file.exists('temp/modonlyTtrendrem0.rds')){
modonlyTtrendrem0 <- readRDS('temp/modonlyTtrendrem0.rds')
} else {
modonlyTtrendrem0 <- lme(Jtutrendrem0 ~ abs(temptrend)*REALM,
random = randef, weights = varef, data = trends[i4,], method = 'REML')
saveRDS(modonlyTtrendrem0, file = 'temp/modonlyTtrendrem0.rds')
}
i5 <- trends[, complete.cases(Jbetatrendrem0, REALM, temptrend)]
if(file.exists('temp/modonlyTtrendJbetarem0.rds')){
modonlyTtrendJbetarem0 <- readRDS('temp/modonlyTtrendJbetarem0.rds')
} else {
modonlyTtrendJbetarem0 <- lme(Jbetatrendrem0 ~ abs(temptrend)*REALM,
random = randef, weights = varef, data = trends[i5,], method = 'REML',
control=lmeControl(msMaxIter = 100, maxIter = 100))
saveRDS(modonlyTtrendJbetarem0, file = 'temp/modonlyTtrendJbetarem0.rds')
}
i6 <- trends[, complete.cases(Horntrendrem0, REALM, temptrend)]
if(file.exists('temp/modonlyTtrendHornrem0.rds')){
modonlyTtrendHornrem0 <- readRDS('temp/modonlyTtrendHornrem0.rds')
} else {
modonlyTtrendHornrem0 <- lme(Horntrendrem0 ~ abs(temptrend)*REALM,
random = randef, weights = varef, data = trends[i6,], method = 'REML')
saveRDS(modonlyTtrendHornrem0, file = 'temp/modonlyTtrendHornrem0.rds')
}
summary(modonlyTtrendrem0)
Linear mixed-effects model fit by REML
Data: trends[i4, ]
Random effects:
Formula: ~abs(temptrend) | STUDY_ID
Structure: General positive-definite, Log-Cholesky parametrization
StdDev Corr
(Intercept) 0.007657053 (Intr)
abs(temptrend) 0.197650298 -0.935
Formula: ~1 | rarefyID %in% STUDY_ID
(Intercept) Residual
StdDev: 0.01097849 2.000161
Variance function:
Structure: Power of variance covariate
Formula: ~nyrBT
Parameter estimates:
power
-2.121022
Fixed effects: Jtutrendrem0 ~ abs(temptrend) * REALM
Correlation:
(Intr) abs(t) REALMM REALMT a():REALMM
abs(temptrend) -0.807
REALMMarine -0.947 0.764
REALMTerrestrial -0.901 0.727 0.853
abs(temptrend):REALMMarine 0.766 -0.949 -0.814 -0.690
abs(temptrend):REALMTerrestrial 0.733 -0.908 -0.693 -0.810 0.862
Standardized Within-Group Residuals:
Min Q1 Med Q3 Max
-6.57101792 -0.22892007 -0.01904447 0.27434430 5.64177564
Number of Observations: 36747
Number of Groups:
STUDY_ID rarefyID %in% STUDY_ID
292 36747
summary(modonlyTtrendJbetarem0)
Linear mixed-effects model fit by REML
Data: trends[i5, ]
Random effects:
Formula: ~abs(temptrend) | STUDY_ID
Structure: General positive-definite, Log-Cholesky parametrization
StdDev Corr
(Intercept) 0.005965236 (Intr)
abs(temptrend) 0.160013131 -0.038
Formula: ~1 | rarefyID %in% STUDY_ID
(Intercept) Residual
StdDev: 0.003861919 0.9688156
Variance function:
Structure: Power of variance covariate
Formula: ~nyrBT
Parameter estimates:
power
-1.887978
Fixed effects: Jbetatrendrem0 ~ abs(temptrend) * REALM
Correlation:
(Intr) abs(t) REALMM REALMT a():REALMM
abs(temptrend) -0.543
REALMMarine -0.941 0.511
REALMTerrestrial -0.906 0.492 0.852
abs(temptrend):REALMMarine 0.515 -0.948 -0.524 -0.467
abs(temptrend):REALMTerrestrial 0.494 -0.908 -0.464 -0.542 0.861
Standardized Within-Group Residuals:
Min Q1 Med Q3 Max
-8.57430409 -0.30896466 -0.02462766 0.32539894 8.23224466
Number of Observations: 36747
Number of Groups:
STUDY_ID rarefyID %in% STUDY_ID
292 36747
summary(modonlyTtrendHornrem0)
Linear mixed-effects model fit by REML
Data: trends[i6, ]
Random effects:
Formula: ~abs(temptrend) | STUDY_ID
Structure: General positive-definite, Log-Cholesky parametrization
StdDev Corr
(Intercept) 0.01201968 (Intr)
abs(temptrend) 0.25314398 0.016
Formula: ~1 | rarefyID %in% STUDY_ID
(Intercept) Residual
StdDev: 0.01882813 2.441788
Variance function:
Structure: Power of variance covariate
Formula: ~nyrBT
Parameter estimates:
power
-2.318769
Fixed effects: Horntrendrem0 ~ abs(temptrend) * REALM
Correlation:
(Intr) abs(t) REALMM REALMT a():REALMM
abs(temptrend) -0.472
REALMMarine -0.944 0.446
REALMTerrestrial -0.899 0.424 0.848
abs(temptrend):REALMMarine 0.447 -0.945 -0.455 -0.401
abs(temptrend):REALMTerrestrial 0.428 -0.906 -0.404 -0.473 0.856
Standardized Within-Group Residuals:
Min Q1 Med Q3 Max
-5.75457482 -0.22483445 -0.02254226 0.23615730 5.73488343
Number of Observations: 36005
Number of Groups:
STUDY_ID rarefyID %in% STUDY_ID
257 36005
colors <- brewer.pal(6, 'Dark2')
# make table of coefficients
coefs <- as.data.frame(summary(modonlyTtrend)$tTable)
coefs2 <- as.data.frame(summary(modonlyTtrendJbeta)$tTable)
coefs3 <- as.data.frame(summary(modonlyTtrendHorn)$tTable)
coefs4 <- as.data.frame(summary(modonlyTtrendrem0)$tTable)
coefs5 <- as.data.frame(summary(modonlyTtrendJbetarem0)$tTable)
coefs6 <- as.data.frame(summary(modonlyTtrendHornrem0)$tTable)
coefs$mod <- 'Jtu'
coefs2$mod <- 'Jbeta'
coefs3$mod <- 'Horn'
coefs4$mod <- 'Jturem0'
coefs5$mod <- 'Jbetarem0'
coefs6$mod <- 'Hornrem0'
rows1 <- which(grepl('temptrend', rownames(coefs))) # extract temperature effect
cols <- c('Value', 'Std.Error', 'mod')
allcoefs <- rbind(coefs[rows1, cols], coefs2[rows1, cols], coefs3[rows1, cols],
coefs4[rows1, cols], coefs5[rows1, cols], coefs6[rows1, cols])
allcoefs$Value[grepl('REALMMarine', rownames(allcoefs))] <-
allcoefs$Value[grepl('REALMMarine', rownames(allcoefs))] +
allcoefs$Value[!grepl('REALM', rownames(allcoefs))] # add intercept to marine effects
allcoefs$Value[grepl('REALMTerrestrial', rownames(allcoefs))] <-
allcoefs$Value[grepl('REALMTerrestrial', rownames(allcoefs))] +
allcoefs$Value[!grepl('REALM', rownames(allcoefs))] # add intercept to terrestrial effects
allcoefs$lCI <- allcoefs$Value - allcoefs$Std.Error # lower confidence interval
allcoefs$uCI <- allcoefs$Value + allcoefs$Std.Error
allcoefs$y <- c(3, 2, 1) + rep(c(0, -0.1, -0.2, -0.3, -0.4, -0.5), c(3, 3, 3, 3, 3, 3)) # y-values
allcoefs$col <- c(rep(colors[1], 3), rep(colors[2], 3), rep(colors[3], 3),
rep(colors[4], 3), rep(colors[5], 3), rep(colors[6], 3))
allcoefs$realm <- rep(c('Freshwater', 'Marine', 'Terrestrial'), 6)
par(las = 1, mai = c(0.8, 2, 0.1, 0.1))
plot(0,0, col = 'white', xlim=c(-0.1, 0.85), ylim = c(0.5,3),
yaxt='n', xlab = 'Turnover per |°C/yr|', ylab ='')
axis(2, at = 3:1, labels = c('Freshwater', 'Marine', 'Terrestrial'), cex.axis = 0.7)
abline(v = 0, col = 'grey')
for(i in 1:nrow(allcoefs)){
with(allcoefs[i, ], points(Value, y, pch = 16, col = col))
with(allcoefs[i, ], lines(x = c(lCI, uCI), y = c(y, y), col = col))
}
legend('bottomright', col = colors, lwd = 1, pch = 16,
legend = c('Jaccard turnover', 'Jaccard total', 'Horn-Morisita',
'Jaccard turnover rem0', 'Jaccard total rem0', 'Horn-Morisita rem0'))
Scatterplot, violin plots, and coefficient plots all together Off for now
# on macbook: fig.width=3, fig.height=2.375, fig.retina=3, out.width=3, out.height=2.375
# on external monitor: fig.width=6, fig.height=4.5
trends[temptrend <= -0.5, temptrendtext := 'Cooling']
trends[abs(temptrend) <= 0.1, temptrendtext := 'Stable']
trends[temptrend >= 0.5, temptrendtext := 'Warming']
trends[abs(rarefyID_y) < 35, latzone := 'Subtropics']
trends[abs(rarefyID_y) >= 35 & abs(rarefyID_x) < 66.56339, latzone := 'Temperate']
trends[abs(rarefyID_y) >= 66.56339, latzone := 'Polar']
trends[, latzone := factor(latzone, levels = c('Subtropics', 'Temperate', 'Polar'))]
p1 <- ggplot(trends, aes(temptrend, Jtutrend, color = REALM, fill = REALM, size = nyrBT)) +
geom_point(na.rm = TRUE, shape = 16, alpha = 0.1) +
geom_smooth(data=subset(trends, abs(temptrend) < 0.75), method = 'gam', formula = y ~ s(x, bs = "cs"),
na.rm = TRUE) +
scale_color_brewer(palette="Set1", name = 'Realm') +
scale_fill_brewer(palette="Set1", name = 'Realm') +
labs(x = 'Temperature trend (°C/yr)', y = 'Jaccard turnover', tag = 'A') +
scale_size_continuous(range = c(1, 8), breaks = c(2, 5, 20)) +
guides(size = guide_legend(title = 'Years',
override.aes = list(linetype=0, fill = NA, alpha = 1))) +
theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(),
panel.background = element_blank(), axis.line = element_line(colour = "black"),
legend.key=element_blank(),
legend.key.size = unit(0.5,"line"),
axis.text=element_text(size=8),
axis.title=element_text(size=10))
p2 <- ggplot(trends[!is.na(temptrendtext), ], aes(temptrendtext, Jtutrend)) +
geom_violin(draw_quantiles = c(0.25, 0.5, 0.75), fill = 'grey') +
labs(x = '', y = 'Jaccard turnover', tag = 'B') +
theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(),
panel.background = element_blank(), axis.line = element_line(colour = "black"),
legend.key=element_blank(),
axis.text=element_text(size=8),
axis.title=element_text(size=10))
p3 <- ggplot(trends[abs(temptrend) >= 0.5 & !is.na(latzone), ], aes(latzone, Jtutrend)) +
geom_violin(draw_quantiles = c(0.25, 0.5, 0.75), fill = 'grey') +
labs(x = '', y = '', tag = 'C') +
theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(),
panel.background = element_blank(), axis.line = element_line(colour = "black"),
legend.key=element_blank(),
axis.text=element_text(size=7),
axis.title=element_text(size=10))
p4 <- ggplot(allcoefs, aes(Value, y, group = mod, color = mod)) +
geom_errorbarh(aes(xmin = lCI, xmax = uCI, height = 0)) +
geom_point() +
labs(x = expression(atop('Temperature change effect', '(Turnover '~degree*'C'^'-1'*')')), y = '', tag = 'D') +
scale_color_grey() +
theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(),
panel.background = element_blank(), axis.line = element_line(colour = "black"),
legend.position='none',
axis.text=element_text(size=7),
axis.title=element_text(size=7)) +
coord_cartesian(xlim =c(0, 1)) +
scale_y_continuous(name = '', breaks = c(1, 2, 3), labels = c('Terrestrial', 'Marine', 'Freshwater'))
grid.arrange(p1, p2, p3, p4, ncol = 3, layout_matrix = rbind(c(1,1,1), c(2,3,4)),
heights=c(unit(0.66, "npc"), unit(0.34, "npc")))
Try static covariates plus interactions of abs temperature trend with each covariate:
Except for thermal bias: interact with temperature trend (not abs)
Try Bowler or Venter/Halpern human impact
# using Bowler for human impact
i <- trends[, complete.cases(Jtutrend, REALM, tempave.sc, tempave_metab.sc, seas.sc, microclim.sc,
temptrend.sc, temptrend_abs.sc, mass.sc, speed.sc, lifespan.sc,
consumerfrac.sc, endothermfrac.sc, nspp.sc, thermal_bias.sc, npp.sc, veg.sc, human_bowler.sc)]
randef <- list(STUDY_ID = ~ temptrend_abs.sc, rarefyID = ~1)
varef <- varPower(-0.5, ~nyrBT)
if(file.exists('temp/modTfull1.rds')){
modTfull1 <- readRDS('temp/modTfull1.rds')
} else {
modTfull1 <- lme(Jtutrend ~ temptrend_abs.sc*REALM +
temptrend_abs.sc*tsign +
temptrend_abs.sc*tempave.sc +
temptrend_abs.sc*tempave_metab.sc +
temptrend_abs.sc*seas.sc +
temptrend_abs.sc*microclim.sc +
temptrend_abs.sc*mass.sc +
temptrend_abs.sc*speed.sc +
temptrend_abs.sc*lifespan.sc +
temptrend_abs.sc*consumerfrac.sc +
temptrend_abs.sc*endothermfrac.sc +
temptrend_abs.sc*nspp.sc +
temptrend_abs.sc*thermal_bias.sc:tsign +
temptrend_abs.sc*npp.sc +
temptrend_abs.sc*veg.sc +
temptrend_abs.sc*human_bowler.sc:REALM2,
random = randef, weights = varef, data = trends[i,], method = 'REML')
saveRDS(modTfull1, file = 'temp/modTfull1.rds')
}
# using Venter/Halpern for human impact
i1.2 <- trends[, complete.cases(Jtutrend, REALM, tempave.sc, tempave_metab.sc, seas.sc, microclim.sc,
temptrend.sc, temptrend_abs.sc, mass.sc, speed.sc, lifespan.sc,
consumerfrac.sc, endothermfrac.sc, nspp.sc, thermal_bias.sc, npp.sc, veg.sc, human_footprint.sc)]
randef <- list(STUDY_ID = ~ temptrend_abs.sc, rarefyID = ~1)
varef <- varPower(-0.5, ~nyrBT)
if(file.exists('temp/modTfullfootprint.rds')){
modTfullfootprint <- readRDS('temp/modTfullfootprint.rds')
} else {
modTfullfootprint <- lme(Jtutrend ~ temptrend_abs.sc*REALM +
temptrend_abs.sc*tsign +
temptrend_abs.sc*tempave.sc +
temptrend_abs.sc*tempave_metab.sc +
temptrend_abs.sc*seas.sc +
temptrend_abs.sc*microclim.sc +
temptrend_abs.sc*mass.sc +
temptrend_abs.sc*speed.sc +
temptrend_abs.sc*lifespan.sc +
temptrend_abs.sc*consumerfrac.sc +
temptrend_abs.sc*endothermfrac.sc +
temptrend_abs.sc*nspp.sc +
temptrend_abs.sc*thermal_bias.sc:tsign +
temptrend_abs.sc*npp.sc +
temptrend_abs.sc*veg.sc +
temptrend_abs.sc*human_footprint.sc:REALM2,
random = randef, weights = varef, data = trends[i1.2,], method = 'REML')
saveRDS(modTfullfootprint, file = 'temp/modTfullfootprint.rds')
}
summary(modTfull1)
Linear mixed-effects model fit by REML
Data: trends[i, ]
Random effects:
Formula: ~temptrend_abs.sc | STUDY_ID
Structure: General positive-definite, Log-Cholesky parametrization
StdDev Corr
(Intercept) 0.04686628 (Intr)
temptrend_abs.sc 0.03743575 -0.109
Formula: ~1 | rarefyID %in% STUDY_ID
(Intercept) Residual
StdDev: 0.000833882 0.2868584
Variance function:
Structure: Power of variance covariate
Formula: ~nyrBT
Parameter estimates:
power
-1.239456
Fixed effects: Jtutrend ~ temptrend_abs.sc * REALM + temptrend_abs.sc * tsign + temptrend_abs.sc * tempave.sc + temptrend_abs.sc * tempave_metab.sc + temptrend_abs.sc * seas.sc + temptrend_abs.sc * microclim.sc + temptrend_abs.sc * mass.sc + temptrend_abs.sc * speed.sc + temptrend_abs.sc * lifespan.sc + temptrend_abs.sc * consumerfrac.sc + temptrend_abs.sc * endothermfrac.sc + temptrend_abs.sc * nspp.sc + temptrend_abs.sc * thermal_bias.sc:tsign + temptrend_abs.sc * npp.sc + temptrend_abs.sc * veg.sc + temptrend_abs.sc * human_bowler.sc:REALM2
Correlation:
(Intr) tmpt_. REALMM REALMT tsign1 tmpv.s tmpv_. ses.sc
temptrend_abs.sc -0.408
REALMMarine -0.928 0.383
REALMTerrestrial -0.865 0.350 0.801
tsign1 -0.037 0.022 0.009 0.012
tempave.sc -0.003 0.001 -0.002 -0.002 -0.071
tempave_metab.sc 0.052 -0.023 -0.045 -0.041 -0.023 -0.469
seas.sc -0.045 0.042 0.063 -0.014 -0.109 0.183 -0.099
microclim.sc -0.016 0.022 0.025 -0.008 0.012 -0.042 -0.026 0.142
mass.sc 0.014 0.009 -0.001 0.001 0.020 0.026 -0.498 0.000
speed.sc 0.002 -0.005 0.013 0.021 -0.047 0.103 -0.279 0.100
lifespan.sc 0.032 -0.022 -0.027 -0.044 -0.015 -0.087 0.707 0.013
consumerfrac.sc -0.017 0.009 0.030 0.272 0.017 -0.019 -0.038 -0.043
endothermfrac.sc 0.146 -0.050 -0.074 -0.308 0.008 0.142 -0.165 0.027
nspp.sc -0.009 -0.017 -0.013 -0.027 -0.039 0.004 -0.015 -0.045
npp.sc 0.010 0.006 -0.014 0.014 0.014 -0.276 0.213 -0.147
veg.sc -0.109 0.141 0.113 0.000 -0.016 0.145 -0.104 0.130
temptrend_abs.sc:REALMMarine 0.392 -0.960 -0.394 -0.330 -0.005 -0.001 0.019 -0.055
temptrend_abs.sc:REALMTerrestrial 0.340 -0.843 -0.314 -0.415 -0.005 -0.012 0.022 0.038
temptrend_abs.sc:tsign1 0.019 -0.046 -0.007 -0.005 -0.486 0.044 0.000 0.014
temptrend_abs.sc:tempave.sc 0.003 -0.009 -0.006 -0.004 0.048 -0.595 0.309 -0.054
temptrend_abs.sc:tempave_metab.sc -0.014 0.027 0.013 0.014 -0.011 0.326 -0.582 -0.010
temptrend_abs.sc:seas.sc 0.021 -0.061 -0.029 0.029 0.043 -0.010 -0.005 -0.618
temptrend_abs.sc:microclim.sc 0.009 -0.030 -0.012 0.010 -0.040 0.075 -0.012 -0.065
temptrend_abs.sc:mass.sc 0.007 -0.015 -0.009 -0.010 -0.014 0.024 0.265 0.007
temptrend_abs.sc:speed.sc -0.005 0.020 -0.004 -0.002 0.024 -0.087 0.129 -0.032
mcrcl. mss.sc spd.sc lfspn. cnsmr. endth. nspp.s npp.sc
temptrend_abs.sc
REALMMarine
REALMTerrestrial
tsign1
tempave.sc
tempave_metab.sc
seas.sc
microclim.sc
mass.sc 0.034
speed.sc 0.068 0.140
lifespan.sc -0.009 -0.774 -0.454
consumerfrac.sc -0.007 0.015 -0.070 -0.047
endothermfrac.sc 0.011 -0.014 -0.169 0.067 -0.331
nspp.sc -0.099 -0.214 0.007 0.145 -0.002 0.085
npp.sc -0.157 -0.041 0.047 0.033 -0.028 -0.083 -0.180
veg.sc 0.001 0.033 0.046 -0.026 -0.049 0.007 0.004 -0.283
temptrend_abs.sc:REALMMarine -0.026 -0.014 -0.007 0.017 -0.010 0.033 0.026 0.011
temptrend_abs.sc:REALMTerrestrial 0.015 -0.014 -0.007 0.027 -0.101 0.134 0.042 -0.028
temptrend_abs.sc:tsign1 -0.037 -0.013 0.017 0.007 -0.006 0.004 0.026 -0.049
temptrend_abs.sc:tempave.sc 0.078 0.024 -0.059 0.029 -0.013 -0.109 -0.016 0.153
temptrend_abs.sc:tempave_metab.sc -0.029 0.250 0.078 -0.346 0.058 0.134 -0.009 -0.139
temptrend_abs.sc:seas.sc -0.092 0.008 -0.035 -0.008 0.031 0.011 0.030 0.081
temptrend_abs.sc:microclim.sc -0.673 -0.015 -0.027 0.008 0.001 0.007 0.039 0.127
temptrend_abs.sc:mass.sc -0.010 -0.552 -0.030 0.436 -0.011 0.019 0.130 0.006
temptrend_abs.sc:speed.sc -0.036 -0.045 -0.536 0.187 0.031 0.092 -0.021 0.003
veg.sc t_.:REALMM t_.:REALMT tm_.:1 tmptrnd_bs.sc:t.
temptrend_abs.sc
REALMMarine
REALMTerrestrial
tsign1
tempave.sc
tempave_metab.sc
seas.sc
microclim.sc
mass.sc
speed.sc
lifespan.sc
consumerfrac.sc
endothermfrac.sc
nspp.sc
npp.sc
veg.sc
temptrend_abs.sc:REALMMarine -0.155
temptrend_abs.sc:REALMTerrestrial 0.009 0.796
temptrend_abs.sc:tsign1 -0.001 0.015 0.007
temptrend_abs.sc:tempave.sc -0.137 0.005 0.024 -0.069
temptrend_abs.sc:tempave_metab.sc 0.064 -0.022 -0.037 0.016 -0.441
temptrend_abs.sc:seas.sc -0.131 0.084 -0.078 -0.019 0.048
temptrend_abs.sc:microclim.sc 0.026 0.034 -0.032 0.048 -0.132
temptrend_abs.sc:mass.sc -0.004 0.021 0.027 0.024 -0.075
temptrend_abs.sc:speed.sc -0.052 0.003 0.001 -0.005 0.157
tm_.:_. tmptrnd_bs.sc:ss. tmptrnd_bs.sc:mc.
temptrend_abs.sc
REALMMarine
REALMTerrestrial
tsign1
tempave.sc
tempave_metab.sc
seas.sc
microclim.sc
mass.sc
speed.sc
lifespan.sc
consumerfrac.sc
endothermfrac.sc
nspp.sc
npp.sc
veg.sc
temptrend_abs.sc:REALMMarine
temptrend_abs.sc:REALMTerrestrial
temptrend_abs.sc:tsign1
temptrend_abs.sc:tempave.sc
temptrend_abs.sc:tempave_metab.sc
temptrend_abs.sc:seas.sc 0.047
temptrend_abs.sc:microclim.sc 0.108 0.136
temptrend_abs.sc:mass.sc -0.471 -0.044 -0.011
temptrend_abs.sc:speed.sc -0.223 0.069 0.041
tmptrnd_bs.sc:ms. tmptrnd_bs.sc:sp. tmptrnd_bs.sc:l.
temptrend_abs.sc
REALMMarine
REALMTerrestrial
tsign1
tempave.sc
tempave_metab.sc
seas.sc
microclim.sc
mass.sc
speed.sc
lifespan.sc
consumerfrac.sc
endothermfrac.sc
nspp.sc
npp.sc
veg.sc
temptrend_abs.sc:REALMMarine
temptrend_abs.sc:REALMTerrestrial
temptrend_abs.sc:tsign1
temptrend_abs.sc:tempave.sc
temptrend_abs.sc:tempave_metab.sc
temptrend_abs.sc:seas.sc
temptrend_abs.sc:microclim.sc
temptrend_abs.sc:mass.sc
temptrend_abs.sc:speed.sc 0.059
tmptrnd_bs.sc:c. tmptrnd_bs.sc:nd. tmptrnd_bs.sc:ns.
temptrend_abs.sc
REALMMarine
REALMTerrestrial
tsign1
tempave.sc
tempave_metab.sc
seas.sc
microclim.sc
mass.sc
speed.sc
lifespan.sc
consumerfrac.sc
endothermfrac.sc
nspp.sc
npp.sc
veg.sc
temptrend_abs.sc:REALMMarine
temptrend_abs.sc:REALMTerrestrial
temptrend_abs.sc:tsign1
temptrend_abs.sc:tempave.sc
temptrend_abs.sc:tempave_metab.sc
temptrend_abs.sc:seas.sc
temptrend_abs.sc:microclim.sc
temptrend_abs.sc:mass.sc
temptrend_abs.sc:speed.sc
t-1:_. ts1:_. tmptrnd_bs.sc:np. tmptrnd_bs.sc:v.
temptrend_abs.sc
REALMMarine
REALMTerrestrial
tsign1
tempave.sc
tempave_metab.sc
seas.sc
microclim.sc
mass.sc
speed.sc
lifespan.sc
consumerfrac.sc
endothermfrac.sc
nspp.sc
npp.sc
veg.sc
temptrend_abs.sc:REALMMarine
temptrend_abs.sc:REALMTerrestrial
temptrend_abs.sc:tsign1
temptrend_abs.sc:tempave.sc
temptrend_abs.sc:tempave_metab.sc
temptrend_abs.sc:seas.sc
temptrend_abs.sc:microclim.sc
temptrend_abs.sc:mass.sc
temptrend_abs.sc:speed.sc
h_.:REALM2T h_.:REALM2M t_.:-1 t_.:1: t_.:_.:REALM2T
temptrend_abs.sc
REALMMarine
REALMTerrestrial
tsign1
tempave.sc
tempave_metab.sc
seas.sc
microclim.sc
mass.sc
speed.sc
lifespan.sc
consumerfrac.sc
endothermfrac.sc
nspp.sc
npp.sc
veg.sc
temptrend_abs.sc:REALMMarine
temptrend_abs.sc:REALMTerrestrial
temptrend_abs.sc:tsign1
temptrend_abs.sc:tempave.sc
temptrend_abs.sc:tempave_metab.sc
temptrend_abs.sc:seas.sc
temptrend_abs.sc:microclim.sc
temptrend_abs.sc:mass.sc
temptrend_abs.sc:speed.sc
[ reached getOption("max.print") -- omitted 14 rows ]
Standardized Within-Group Residuals:
Min Q1 Med Q3 Max
-8.34716400 -0.35364009 0.05228794 0.52742556 6.59480022
Number of Observations: 43493
Number of Groups:
STUDY_ID rarefyID %in% STUDY_ID
235 43493
summary(modTfullfootprint)
Linear mixed-effects model fit by REML
Data: trends[i1.2, ]
Random effects:
Formula: ~temptrend_abs.sc | STUDY_ID
Structure: General positive-definite, Log-Cholesky parametrization
StdDev Corr
(Intercept) 0.04731816 (Intr)
temptrend_abs.sc 0.03945538 -0.122
Formula: ~1 | rarefyID %in% STUDY_ID
(Intercept) Residual
StdDev: 2.288017e-06 0.2861346
Variance function:
Structure: Power of variance covariate
Formula: ~nyrBT
Parameter estimates:
power
-1.238289
Fixed effects: Jtutrend ~ temptrend_abs.sc * REALM + temptrend_abs.sc * tsign + temptrend_abs.sc * tempave.sc + temptrend_abs.sc * tempave_metab.sc + temptrend_abs.sc * seas.sc + temptrend_abs.sc * microclim.sc + temptrend_abs.sc * mass.sc + temptrend_abs.sc * speed.sc + temptrend_abs.sc * lifespan.sc + temptrend_abs.sc * consumerfrac.sc + temptrend_abs.sc * endothermfrac.sc + temptrend_abs.sc * nspp.sc + temptrend_abs.sc * thermal_bias.sc:tsign + temptrend_abs.sc * npp.sc + temptrend_abs.sc * veg.sc + temptrend_abs.sc * human_footprint.sc:REALM2
Correlation:
(Intr) tmpt_. REALMM REALMT tsign1 tmpv.s tmpv_.
temptrend_abs.sc -0.417
REALMMarine -0.925 0.390
REALMTerrestrial -0.865 0.359 0.799
tsign1 -0.036 0.020 0.008 0.012
tempave.sc -0.011 0.009 0.005 -0.005 -0.063
tempave_metab.sc 0.057 -0.028 -0.049 -0.039 -0.027 -0.474
seas.sc -0.047 0.034 0.064 -0.013 -0.113 0.192 -0.109
microclim.sc -0.017 0.016 0.028 -0.007 0.004 0.021 -0.055
mass.sc 0.015 0.008 -0.003 0.001 0.021 0.037 -0.501
speed.sc 0.003 -0.006 0.013 0.020 -0.045 0.099 -0.272
lifespan.sc 0.032 -0.022 -0.026 -0.044 -0.014 -0.099 0.710
consumerfrac.sc -0.015 0.007 0.031 0.263 0.016 -0.026 -0.036
endothermfrac.sc 0.145 -0.051 -0.076 -0.312 0.010 0.134 -0.163
nspp.sc -0.008 -0.017 -0.012 -0.028 -0.038 0.018 -0.019
npp.sc 0.018 0.001 -0.024 0.013 0.015 -0.336 0.252
veg.sc -0.114 0.133 0.116 0.003 -0.018 0.195 -0.139
temptrend_abs.sc:REALMMarine 0.400 -0.958 -0.401 -0.339 -0.004 -0.011 0.024
temptrend_abs.sc:REALMTerrestrial 0.346 -0.845 -0.318 -0.420 -0.006 -0.008 0.018
temptrend_abs.sc:tsign1 0.018 -0.043 -0.005 -0.005 -0.486 0.044 0.000
temptrend_abs.sc:tempave.sc 0.008 -0.023 -0.012 -0.002 0.044 -0.604 0.312
temptrend_abs.sc:tempave_metab.sc -0.018 0.035 0.017 0.011 -0.008 0.332 -0.585
temptrend_abs.sc:seas.sc 0.018 -0.048 -0.026 0.025 0.051 -0.037 0.006
temptrend_abs.sc:microclim.sc 0.006 -0.016 -0.011 0.008 -0.039 0.053 0.000
temptrend_abs.sc:mass.sc 0.006 -0.013 -0.008 -0.010 -0.014 0.021 0.266
temptrend_abs.sc:speed.sc -0.005 0.020 -0.006 -0.002 0.025 -0.090 0.127
ses.sc mcrcl. mss.sc spd.sc lfspn. cnsmr. endth.
temptrend_abs.sc
REALMMarine
REALMTerrestrial
tsign1
tempave.sc
tempave_metab.sc
seas.sc
microclim.sc 0.183
mass.sc -0.006 0.011
speed.sc 0.093 0.071 0.137
lifespan.sc 0.014 0.006 -0.774 -0.449
consumerfrac.sc -0.041 0.003 0.016 -0.067 -0.049
endothermfrac.sc 0.029 0.027 -0.010 -0.168 0.063 -0.329
nspp.sc -0.037 -0.104 -0.217 0.010 0.150 -0.003 0.090
npp.sc -0.208 -0.210 -0.042 0.048 0.031 -0.033 -0.099
veg.sc 0.126 0.018 0.036 0.042 -0.028 -0.052 0.018
temptrend_abs.sc:REALMMarine -0.046 -0.020 -0.012 -0.008 0.016 -0.009 0.032
temptrend_abs.sc:REALMTerrestrial 0.034 0.016 -0.015 -0.006 0.028 -0.095 0.139
temptrend_abs.sc:tsign1 0.022 -0.033 -0.012 0.017 0.006 -0.004 0.003
temptrend_abs.sc:tempave.sc -0.070 0.053 0.019 -0.059 0.035 -0.013 -0.106
temptrend_abs.sc:tempave_metab.sc 0.002 -0.014 0.251 0.076 -0.350 0.055 0.135
temptrend_abs.sc:seas.sc -0.617 -0.089 0.017 -0.039 -0.015 0.029 0.006
temptrend_abs.sc:microclim.sc -0.060 -0.703 -0.006 -0.034 0.001 -0.002 0.001
temptrend_abs.sc:mass.sc 0.014 0.001 -0.553 -0.026 0.436 -0.011 0.017
temptrend_abs.sc:speed.sc -0.037 -0.040 -0.041 -0.537 0.182 0.030 0.091
nspp.s npp.sc veg.sc t_.:REALMM t_.:REALMT tm_.:1
temptrend_abs.sc
REALMMarine
REALMTerrestrial
tsign1
tempave.sc
tempave_metab.sc
seas.sc
microclim.sc
mass.sc
speed.sc
lifespan.sc
consumerfrac.sc
endothermfrac.sc
nspp.sc
npp.sc -0.188
veg.sc 0.010 -0.331
temptrend_abs.sc:REALMMarine 0.025 0.016 -0.145
temptrend_abs.sc:REALMTerrestrial 0.042 -0.027 0.000 0.797
temptrend_abs.sc:tsign1 0.027 -0.049 0.009 0.011 0.010
temptrend_abs.sc:tempave.sc -0.022 0.183 -0.189 0.021 0.019 -0.065
temptrend_abs.sc:tempave_metab.sc -0.005 -0.164 0.101 -0.030 -0.032 0.012
temptrend_abs.sc:seas.sc 0.030 0.107 -0.098 0.069 -0.071 -0.031
temptrend_abs.sc:microclim.sc 0.040 0.153 0.051 0.021 -0.030 0.041
temptrend_abs.sc:mass.sc 0.133 0.009 -0.002 0.018 0.028 0.023
temptrend_abs.sc:speed.sc -0.024 0.002 -0.052 0.004 0.000 -0.005
tmptrnd_bs.sc:t. tm_.:_. tmptrnd_bs.sc:ss.
temptrend_abs.sc
REALMMarine
REALMTerrestrial
tsign1
tempave.sc
tempave_metab.sc
seas.sc
microclim.sc
mass.sc
speed.sc
lifespan.sc
consumerfrac.sc
endothermfrac.sc
nspp.sc
npp.sc
veg.sc
temptrend_abs.sc:REALMMarine
temptrend_abs.sc:REALMTerrestrial
temptrend_abs.sc:tsign1
temptrend_abs.sc:tempave.sc
temptrend_abs.sc:tempave_metab.sc -0.435
temptrend_abs.sc:seas.sc 0.069 0.040
temptrend_abs.sc:microclim.sc -0.106 0.099 0.110
temptrend_abs.sc:mass.sc -0.070 -0.473 -0.056
temptrend_abs.sc:speed.sc 0.160 -0.220 0.075
tmptrnd_bs.sc:mc. tmptrnd_bs.sc:ms.
temptrend_abs.sc
REALMMarine
REALMTerrestrial
tsign1
tempave.sc
tempave_metab.sc
seas.sc
microclim.sc
mass.sc
speed.sc
lifespan.sc
consumerfrac.sc
endothermfrac.sc
nspp.sc
npp.sc
veg.sc
temptrend_abs.sc:REALMMarine
temptrend_abs.sc:REALMTerrestrial
temptrend_abs.sc:tsign1
temptrend_abs.sc:tempave.sc
temptrend_abs.sc:tempave_metab.sc
temptrend_abs.sc:seas.sc
temptrend_abs.sc:microclim.sc
temptrend_abs.sc:mass.sc -0.024
temptrend_abs.sc:speed.sc 0.045 0.056
tmptrnd_bs.sc:sp. tmptrnd_bs.sc:l. tmptrnd_bs.sc:c.
temptrend_abs.sc
REALMMarine
REALMTerrestrial
tsign1
tempave.sc
tempave_metab.sc
seas.sc
microclim.sc
mass.sc
speed.sc
lifespan.sc
consumerfrac.sc
endothermfrac.sc
nspp.sc
npp.sc
veg.sc
temptrend_abs.sc:REALMMarine
temptrend_abs.sc:REALMTerrestrial
temptrend_abs.sc:tsign1
temptrend_abs.sc:tempave.sc
temptrend_abs.sc:tempave_metab.sc
temptrend_abs.sc:seas.sc
temptrend_abs.sc:microclim.sc
temptrend_abs.sc:mass.sc
temptrend_abs.sc:speed.sc
tmptrnd_bs.sc:nd. tmptrnd_bs.sc:ns. t-1:_. ts1:_.
temptrend_abs.sc
REALMMarine
REALMTerrestrial
tsign1
tempave.sc
tempave_metab.sc
seas.sc
microclim.sc
mass.sc
speed.sc
lifespan.sc
consumerfrac.sc
endothermfrac.sc
nspp.sc
npp.sc
veg.sc
temptrend_abs.sc:REALMMarine
temptrend_abs.sc:REALMTerrestrial
temptrend_abs.sc:tsign1
temptrend_abs.sc:tempave.sc
temptrend_abs.sc:tempave_metab.sc
temptrend_abs.sc:seas.sc
temptrend_abs.sc:microclim.sc
temptrend_abs.sc:mass.sc
temptrend_abs.sc:speed.sc
tmptrnd_bs.sc:np. tmptrnd_bs.sc:v. h_.:REALM2T
temptrend_abs.sc
REALMMarine
REALMTerrestrial
tsign1
tempave.sc
tempave_metab.sc
seas.sc
microclim.sc
mass.sc
speed.sc
lifespan.sc
consumerfrac.sc
endothermfrac.sc
nspp.sc
npp.sc
veg.sc
temptrend_abs.sc:REALMMarine
temptrend_abs.sc:REALMTerrestrial
temptrend_abs.sc:tsign1
temptrend_abs.sc:tempave.sc
temptrend_abs.sc:tempave_metab.sc
temptrend_abs.sc:seas.sc
temptrend_abs.sc:microclim.sc
temptrend_abs.sc:mass.sc
temptrend_abs.sc:speed.sc
h_.:REALM2M t_.:-1 t_.:1: t_.:_.:REALM2T
temptrend_abs.sc
REALMMarine
REALMTerrestrial
tsign1
tempave.sc
tempave_metab.sc
seas.sc
microclim.sc
mass.sc
speed.sc
lifespan.sc
consumerfrac.sc
endothermfrac.sc
nspp.sc
npp.sc
veg.sc
temptrend_abs.sc:REALMMarine
temptrend_abs.sc:REALMTerrestrial
temptrend_abs.sc:tsign1
temptrend_abs.sc:tempave.sc
temptrend_abs.sc:tempave_metab.sc
temptrend_abs.sc:seas.sc
temptrend_abs.sc:microclim.sc
temptrend_abs.sc:mass.sc
temptrend_abs.sc:speed.sc
[ reached getOption("max.print") -- omitted 14 rows ]
Standardized Within-Group Residuals:
Min Q1 Med Q3 Max
-8.3520451 -0.3535263 0.0534660 0.5265006 6.6044778
Number of Observations: 43174
Number of Groups:
STUDY_ID rarefyID %in% STUDY_ID
227 43174
Try Bowler or Venter/Halpern human impact
summary(modTfullrem0)
Linear mixed-effects model fit by REML
Data: trends[i1, ]
Random effects:
Formula: ~temptrend_abs.sc | STUDY_ID
Structure: General positive-definite, Log-Cholesky parametrization
StdDev Corr
(Intercept) 0.007404753 (Intr)
temptrend_abs.sc 0.012100255 0.189
Formula: ~1 | rarefyID %in% STUDY_ID
(Intercept) Residual
StdDev: 0.003350251 1.507894
Variance function:
Structure: Power of variance covariate
Formula: ~nyrBT
Parameter estimates:
power
-1.902506
Fixed effects: Jtutrendrem0 ~ temptrend_abs.sc * REALM + temptrend_abs.sc * tsign + temptrend_abs.sc * tempave.sc + temptrend_abs.sc * tempave_metab.sc + temptrend_abs.sc * seas.sc + temptrend_abs.sc * microclim.sc + temptrend_abs.sc * mass.sc + temptrend_abs.sc * speed.sc + temptrend_abs.sc * lifespan.sc + temptrend_abs.sc * consumerfrac.sc + temptrend_abs.sc * endothermfrac.sc + temptrend_abs.sc * nspp.sc + temptrend_abs.sc * thermal_bias.sc:tsign + temptrend_abs.sc * npp.sc + temptrend_abs.sc * veg.sc + temptrend_abs.sc * human_bowler.sc:REALM2
Correlation:
(Intr) tmpt_. REALMM REALMT tsign1 tmpv.s tmpv_. ses.sc
temptrend_abs.sc -0.613
REALMMarine -0.940 0.600
REALMTerrestrial -0.692 0.344 0.639
tsign1 -0.180 0.089 0.044 0.033
tempave.sc -0.027 0.010 0.037 0.010 -0.061
tempave_metab.sc 0.121 -0.064 -0.131 -0.086 -0.013 -0.573
seas.sc -0.130 0.091 0.183 -0.087 -0.105 0.243 -0.078
microclim.sc -0.098 0.105 0.112 -0.015 0.047 0.022 -0.072 0.146
mass.sc -0.015 0.056 0.026 0.072 0.021 0.001 -0.509 0.008
speed.sc 0.080 -0.035 -0.018 -0.071 -0.041 0.055 -0.224 0.052
lifespan.sc 0.079 -0.073 -0.090 -0.088 -0.041 -0.038 0.631 0.045
consumerfrac.sc -0.081 0.052 0.042 0.345 0.046 0.027 -0.042 -0.111
endothermfrac.sc -0.026 0.006 0.031 -0.191 0.020 0.506 -0.542 0.106
nspp.sc 0.033 -0.078 -0.101 -0.150 -0.043 0.017 0.010 -0.089
npp.sc 0.037 -0.012 -0.063 0.044 0.004 -0.244 0.243 -0.084
veg.sc -0.475 0.482 0.506 0.007 -0.002 0.129 -0.132 0.080
temptrend_abs.sc:REALMMarine 0.599 -0.964 -0.613 -0.321 -0.029 -0.031 0.069 -0.112
temptrend_abs.sc:REALMTerrestrial 0.353 -0.648 -0.329 -0.540 -0.017 0.007 0.044 0.134
temptrend_abs.sc:tsign1 0.107 -0.178 -0.050 -0.019 -0.519 0.079 -0.008 0.030
temptrend_abs.sc:tempave.sc 0.047 -0.021 -0.061 -0.005 0.062 -0.730 0.460 -0.202
temptrend_abs.sc:tempave_metab.sc -0.055 0.071 0.060 0.053 -0.018 0.446 -0.685 0.021
temptrend_abs.sc:seas.sc 0.077 -0.124 -0.105 0.124 0.067 -0.146 0.038 -0.732
temptrend_abs.sc:microclim.sc 0.088 -0.145 -0.094 0.017 -0.055 0.018 0.040 -0.081
temptrend_abs.sc:mass.sc 0.039 -0.051 -0.038 -0.062 -0.017 0.031 0.297 0.016
temptrend_abs.sc:speed.sc -0.058 0.057 0.034 0.080 0.034 -0.046 0.161 0.000
mcrcl. mss.sc spd.sc lfspn. cnsmr. endth. nspp.s npp.sc
temptrend_abs.sc
REALMMarine
REALMTerrestrial
tsign1
tempave.sc
tempave_metab.sc
seas.sc
microclim.sc
mass.sc 0.006
speed.sc 0.049 0.115
lifespan.sc 0.003 -0.848 -0.377
consumerfrac.sc -0.016 0.104 -0.336 -0.026
endothermfrac.sc 0.063 -0.096 -0.289 0.117 -0.078
nspp.sc -0.113 -0.164 0.018 0.181 -0.052 0.168
npp.sc -0.187 -0.036 0.043 0.033 -0.031 -0.217 -0.172
veg.sc 0.031 0.046 0.040 -0.055 -0.010 0.082 0.008 -0.273
temptrend_abs.sc:REALMMarine -0.107 -0.054 0.010 0.070 -0.034 -0.006 0.104 0.055
temptrend_abs.sc:REALMTerrestrial 0.021 -0.080 0.058 0.072 -0.187 0.091 0.148 -0.068
temptrend_abs.sc:tsign1 -0.046 -0.021 0.019 0.034 -0.027 0.013 0.031 -0.035
temptrend_abs.sc:tempave.sc 0.011 0.034 -0.020 -0.005 -0.010 -0.454 -0.029 0.176
temptrend_abs.sc:tempave_metab.sc -0.006 0.307 0.127 -0.382 0.066 0.406 -0.013 -0.177
temptrend_abs.sc:seas.sc -0.105 0.006 -0.017 -0.038 0.103 -0.073 0.069 0.065
temptrend_abs.sc:microclim.sc -0.812 0.006 -0.025 -0.005 0.000 -0.039 0.064 0.182
temptrend_abs.sc:mass.sc 0.024 -0.603 -0.058 0.524 -0.064 0.068 0.109 -0.012
temptrend_abs.sc:speed.sc -0.011 -0.067 -0.630 0.222 0.224 0.160 -0.065 -0.009
veg.sc t_.:REALMM t_.:REALMT tm_.:1 tmptrnd_bs.sc:t.
temptrend_abs.sc
REALMMarine
REALMTerrestrial
tsign1
tempave.sc
tempave_metab.sc
seas.sc
microclim.sc
mass.sc
speed.sc
lifespan.sc
consumerfrac.sc
endothermfrac.sc
nspp.sc
npp.sc
veg.sc
temptrend_abs.sc:REALMMarine -0.516
temptrend_abs.sc:REALMTerrestrial 0.021 0.600
temptrend_abs.sc:tsign1 -0.023 0.069 0.019
temptrend_abs.sc:tempave.sc -0.120 0.057 -0.035 -0.106
temptrend_abs.sc:tempave_metab.sc 0.102 -0.077 -0.080 0.021 -0.498
temptrend_abs.sc:seas.sc -0.074 0.164 -0.214 -0.051 0.285
temptrend_abs.sc:microclim.sc -0.051 0.152 -0.038 0.048 -0.028
temptrend_abs.sc:mass.sc -0.017 0.054 0.122 0.028 -0.051
temptrend_abs.sc:speed.sc -0.036 -0.017 -0.059 -0.017 0.064
tm_.:_. tmptrnd_bs.sc:ss. tmptrnd_bs.sc:mc.
temptrend_abs.sc
REALMMarine
REALMTerrestrial
tsign1
tempave.sc
tempave_metab.sc
seas.sc
microclim.sc
mass.sc
speed.sc
lifespan.sc
consumerfrac.sc
endothermfrac.sc
nspp.sc
npp.sc
veg.sc
temptrend_abs.sc:REALMMarine
temptrend_abs.sc:REALMTerrestrial
temptrend_abs.sc:tsign1
temptrend_abs.sc:tempave.sc
temptrend_abs.sc:tempave_metab.sc
temptrend_abs.sc:seas.sc -0.036
temptrend_abs.sc:microclim.sc 0.056 0.146
temptrend_abs.sc:mass.sc -0.539 -0.053 -0.049
temptrend_abs.sc:speed.sc -0.292 0.050 0.018
tmptrnd_bs.sc:ms. tmptrnd_bs.sc:sp. tmptrnd_bs.sc:l.
temptrend_abs.sc
REALMMarine
REALMTerrestrial
tsign1
tempave.sc
tempave_metab.sc
seas.sc
microclim.sc
mass.sc
speed.sc
lifespan.sc
consumerfrac.sc
endothermfrac.sc
nspp.sc
npp.sc
veg.sc
temptrend_abs.sc:REALMMarine
temptrend_abs.sc:REALMTerrestrial
temptrend_abs.sc:tsign1
temptrend_abs.sc:tempave.sc
temptrend_abs.sc:tempave_metab.sc
temptrend_abs.sc:seas.sc
temptrend_abs.sc:microclim.sc
temptrend_abs.sc:mass.sc
temptrend_abs.sc:speed.sc 0.140
tmptrnd_bs.sc:c. tmptrnd_bs.sc:nd. tmptrnd_bs.sc:ns.
temptrend_abs.sc
REALMMarine
REALMTerrestrial
tsign1
tempave.sc
tempave_metab.sc
seas.sc
microclim.sc
mass.sc
speed.sc
lifespan.sc
consumerfrac.sc
endothermfrac.sc
nspp.sc
npp.sc
veg.sc
temptrend_abs.sc:REALMMarine
temptrend_abs.sc:REALMTerrestrial
temptrend_abs.sc:tsign1
temptrend_abs.sc:tempave.sc
temptrend_abs.sc:tempave_metab.sc
temptrend_abs.sc:seas.sc
temptrend_abs.sc:microclim.sc
temptrend_abs.sc:mass.sc
temptrend_abs.sc:speed.sc
t-1:_. ts1:_. tmptrnd_bs.sc:np. tmptrnd_bs.sc:v.
temptrend_abs.sc
REALMMarine
REALMTerrestrial
tsign1
tempave.sc
tempave_metab.sc
seas.sc
microclim.sc
mass.sc
speed.sc
lifespan.sc
consumerfrac.sc
endothermfrac.sc
nspp.sc
npp.sc
veg.sc
temptrend_abs.sc:REALMMarine
temptrend_abs.sc:REALMTerrestrial
temptrend_abs.sc:tsign1
temptrend_abs.sc:tempave.sc
temptrend_abs.sc:tempave_metab.sc
temptrend_abs.sc:seas.sc
temptrend_abs.sc:microclim.sc
temptrend_abs.sc:mass.sc
temptrend_abs.sc:speed.sc
h_.:REALM2T h_.:REALM2M t_.:-1 t_.:1: t_.:_.:REALM2T
temptrend_abs.sc
REALMMarine
REALMTerrestrial
tsign1
tempave.sc
tempave_metab.sc
seas.sc
microclim.sc
mass.sc
speed.sc
lifespan.sc
consumerfrac.sc
endothermfrac.sc
nspp.sc
npp.sc
veg.sc
temptrend_abs.sc:REALMMarine
temptrend_abs.sc:REALMTerrestrial
temptrend_abs.sc:tsign1
temptrend_abs.sc:tempave.sc
temptrend_abs.sc:tempave_metab.sc
temptrend_abs.sc:seas.sc
temptrend_abs.sc:microclim.sc
temptrend_abs.sc:mass.sc
temptrend_abs.sc:speed.sc
[ reached getOption("max.print") -- omitted 14 rows ]
Standardized Within-Group Residuals:
Min Q1 Med Q3 Max
-7.01782639 -0.26254472 -0.02396528 0.31237827 5.40866015
Number of Observations: 31072
Number of Groups:
STUDY_ID rarefyID %in% STUDY_ID
218 31072
summary(modTfullfootprintrem0)
Linear mixed-effects model fit by REML
Data: trends[i2, ]
Random effects:
Formula: ~temptrend_abs.sc | STUDY_ID
Structure: General positive-definite, Log-Cholesky parametrization
StdDev Corr
(Intercept) 0.007176109 (Intr)
temptrend_abs.sc 0.015663961 0.105
Formula: ~1 | rarefyID %in% STUDY_ID
(Intercept) Residual
StdDev: 0.003466799 1.508598
Variance function:
Structure: Power of variance covariate
Formula: ~nyrBT
Parameter estimates:
power
-1.903419
Fixed effects: Jtutrendrem0 ~ temptrend_abs.sc * REALM + temptrend_abs.sc * tsign + temptrend_abs.sc * tempave.sc + temptrend_abs.sc * tempave_metab.sc + temptrend_abs.sc * seas.sc + temptrend_abs.sc * microclim.sc + temptrend_abs.sc * mass.sc + temptrend_abs.sc * speed.sc + temptrend_abs.sc * lifespan.sc + temptrend_abs.sc * consumerfrac.sc + temptrend_abs.sc * endothermfrac.sc + temptrend_abs.sc * nspp.sc + temptrend_abs.sc * thermal_bias.sc:tsign + temptrend_abs.sc * npp.sc + temptrend_abs.sc * veg.sc + temptrend_abs.sc * human_footprint.sc:REALM2
Correlation:
(Intr) tmpt_. REALMM REALMT tsign1 tmpv.s tmpv_.
temptrend_abs.sc -0.624
REALMMarine -0.940 0.606
REALMTerrestrial -0.673 0.357 0.615
tsign1 -0.179 0.082 0.041 0.041
tempave.sc -0.054 0.035 0.068 -0.001 -0.055
tempave_metab.sc 0.142 -0.078 -0.152 -0.076 -0.025 -0.572
seas.sc -0.130 0.085 0.182 -0.098 -0.107 0.247 -0.073
microclim.sc -0.091 0.083 0.105 -0.014 0.042 0.063 -0.091
mass.sc -0.015 0.053 0.023 0.082 0.022 0.014 -0.510
speed.sc 0.083 -0.041 -0.016 -0.091 -0.040 0.057 -0.216
lifespan.sc 0.083 -0.071 -0.096 -0.085 -0.043 -0.052 0.637
consumerfrac.sc -0.076 0.047 0.032 0.359 0.047 0.031 -0.037
endothermfrac.sc -0.046 0.018 0.050 -0.203 0.027 0.494 -0.546
nspp.sc 0.034 -0.071 -0.096 -0.150 -0.042 0.021 0.006
npp.sc 0.074 -0.038 -0.104 0.026 0.005 -0.280 0.264
veg.sc -0.505 0.473 0.536 0.013 -0.007 0.174 -0.164
temptrend_abs.sc:REALMMarine 0.607 -0.959 -0.620 -0.327 -0.023 -0.060 0.084
temptrend_abs.sc:REALMTerrestrial 0.350 -0.651 -0.319 -0.559 -0.023 0.018 0.032
temptrend_abs.sc:tsign1 0.101 -0.161 -0.041 -0.024 -0.518 0.078 -0.006
temptrend_abs.sc:tempave.sc 0.073 -0.058 -0.093 0.001 0.057 -0.736 0.448
temptrend_abs.sc:tempave_metab.sc -0.074 0.090 0.080 0.045 -0.009 0.440 -0.686
temptrend_abs.sc:seas.sc 0.080 -0.131 -0.112 0.127 0.070 -0.163 0.034
temptrend_abs.sc:microclim.sc 0.067 -0.107 -0.073 0.021 -0.051 -0.007 0.051
temptrend_abs.sc:mass.sc 0.036 -0.043 -0.036 -0.065 -0.018 0.028 0.299
temptrend_abs.sc:speed.sc -0.060 0.061 0.028 0.087 0.035 -0.053 0.150
ses.sc mcrcl. mss.sc spd.sc lfspn. cnsmr. endth.
temptrend_abs.sc
REALMMarine
REALMTerrestrial
tsign1
tempave.sc
tempave_metab.sc
seas.sc
microclim.sc 0.156
mass.sc 0.010 -0.002
speed.sc 0.051 0.054 0.100
lifespan.sc 0.045 0.011 -0.837 -0.370
consumerfrac.sc -0.111 -0.011 0.121 -0.358 -0.010
endothermfrac.sc 0.104 0.088 -0.090 -0.281 0.103 -0.079
nspp.sc -0.100 -0.124 -0.168 0.024 0.179 -0.054 0.169
npp.sc -0.132 -0.206 -0.043 0.045 0.031 -0.058 -0.224
veg.sc 0.096 0.025 0.046 0.035 -0.053 -0.001 0.112
temptrend_abs.sc:REALMMarine -0.111 -0.088 -0.051 0.009 0.067 -0.025 -0.020
temptrend_abs.sc:REALMTerrestrial 0.138 0.024 -0.082 0.069 0.067 -0.207 0.112
temptrend_abs.sc:tsign1 0.040 -0.032 -0.019 0.017 0.033 -0.021 0.010
temptrend_abs.sc:tempave.sc -0.210 -0.016 0.025 -0.034 0.007 -0.008 -0.428
temptrend_abs.sc:tempave_metab.sc 0.015 0.006 0.308 0.120 -0.391 0.051 0.410
temptrend_abs.sc:seas.sc -0.736 -0.103 0.007 -0.031 -0.040 0.106 -0.068
temptrend_abs.sc:microclim.sc -0.081 -0.822 0.010 -0.034 -0.009 0.006 -0.051
temptrend_abs.sc:mass.sc 0.015 0.028 -0.604 -0.047 0.522 -0.068 0.064
temptrend_abs.sc:speed.sc -0.014 -0.017 -0.053 -0.636 0.211 0.243 0.162
nspp.s npp.sc veg.sc t_.:REALMM t_.:REALMT tm_.:1
temptrend_abs.sc
REALMMarine
REALMTerrestrial
tsign1
tempave.sc
tempave_metab.sc
seas.sc
microclim.sc
mass.sc
speed.sc
lifespan.sc
consumerfrac.sc
endothermfrac.sc
nspp.sc
npp.sc -0.176
veg.sc 0.018 -0.310
temptrend_abs.sc:REALMMarine 0.098 0.081 -0.506
temptrend_abs.sc:REALMTerrestrial 0.138 -0.049 0.015 0.593
temptrend_abs.sc:tsign1 0.026 -0.036 -0.011 0.054 0.026
temptrend_abs.sc:tempave.sc -0.018 0.192 -0.170 0.097 -0.037 -0.102
temptrend_abs.sc:tempave_metab.sc -0.008 -0.190 0.129 -0.094 -0.067 0.018
temptrend_abs.sc:seas.sc 0.084 0.092 -0.092 0.177 -0.206 -0.064
temptrend_abs.sc:microclim.sc 0.072 0.194 -0.016 0.120 -0.046 0.024
temptrend_abs.sc:mass.sc 0.113 -0.009 -0.012 0.045 0.119 0.026
temptrend_abs.sc:speed.sc -0.062 -0.010 -0.033 -0.012 -0.065 -0.013
tmptrnd_bs.sc:t. tm_.:_. tmptrnd_bs.sc:ss.
temptrend_abs.sc
REALMMarine
REALMTerrestrial
tsign1
tempave.sc
tempave_metab.sc
seas.sc
microclim.sc
mass.sc
speed.sc
lifespan.sc
consumerfrac.sc
endothermfrac.sc
nspp.sc
npp.sc
veg.sc
temptrend_abs.sc:REALMMarine
temptrend_abs.sc:REALMTerrestrial
temptrend_abs.sc:tsign1
temptrend_abs.sc:tempave.sc
temptrend_abs.sc:tempave_metab.sc -0.473
temptrend_abs.sc:seas.sc 0.292 -0.025
temptrend_abs.sc:microclim.sc 0.014 0.048 0.161
temptrend_abs.sc:mass.sc -0.042 -0.542 -0.049
temptrend_abs.sc:speed.sc 0.075 -0.279 0.060
tmptrnd_bs.sc:mc. tmptrnd_bs.sc:ms.
temptrend_abs.sc
REALMMarine
REALMTerrestrial
tsign1
tempave.sc
tempave_metab.sc
seas.sc
microclim.sc
mass.sc
speed.sc
lifespan.sc
consumerfrac.sc
endothermfrac.sc
nspp.sc
npp.sc
veg.sc
temptrend_abs.sc:REALMMarine
temptrend_abs.sc:REALMTerrestrial
temptrend_abs.sc:tsign1
temptrend_abs.sc:tempave.sc
temptrend_abs.sc:tempave_metab.sc
temptrend_abs.sc:seas.sc
temptrend_abs.sc:microclim.sc
temptrend_abs.sc:mass.sc -0.057
temptrend_abs.sc:speed.sc 0.026 0.130
tmptrnd_bs.sc:sp. tmptrnd_bs.sc:l. tmptrnd_bs.sc:c.
temptrend_abs.sc
REALMMarine
REALMTerrestrial
tsign1
tempave.sc
tempave_metab.sc
seas.sc
microclim.sc
mass.sc
speed.sc
lifespan.sc
consumerfrac.sc
endothermfrac.sc
nspp.sc
npp.sc
veg.sc
temptrend_abs.sc:REALMMarine
temptrend_abs.sc:REALMTerrestrial
temptrend_abs.sc:tsign1
temptrend_abs.sc:tempave.sc
temptrend_abs.sc:tempave_metab.sc
temptrend_abs.sc:seas.sc
temptrend_abs.sc:microclim.sc
temptrend_abs.sc:mass.sc
temptrend_abs.sc:speed.sc
tmptrnd_bs.sc:nd. tmptrnd_bs.sc:ns. t-1:_. ts1:_.
temptrend_abs.sc
REALMMarine
REALMTerrestrial
tsign1
tempave.sc
tempave_metab.sc
seas.sc
microclim.sc
mass.sc
speed.sc
lifespan.sc
consumerfrac.sc
endothermfrac.sc
nspp.sc
npp.sc
veg.sc
temptrend_abs.sc:REALMMarine
temptrend_abs.sc:REALMTerrestrial
temptrend_abs.sc:tsign1
temptrend_abs.sc:tempave.sc
temptrend_abs.sc:tempave_metab.sc
temptrend_abs.sc:seas.sc
temptrend_abs.sc:microclim.sc
temptrend_abs.sc:mass.sc
temptrend_abs.sc:speed.sc
tmptrnd_bs.sc:np. tmptrnd_bs.sc:v. h_.:REALM2T
temptrend_abs.sc
REALMMarine
REALMTerrestrial
tsign1
tempave.sc
tempave_metab.sc
seas.sc
microclim.sc
mass.sc
speed.sc
lifespan.sc
consumerfrac.sc
endothermfrac.sc
nspp.sc
npp.sc
veg.sc
temptrend_abs.sc:REALMMarine
temptrend_abs.sc:REALMTerrestrial
temptrend_abs.sc:tsign1
temptrend_abs.sc:tempave.sc
temptrend_abs.sc:tempave_metab.sc
temptrend_abs.sc:seas.sc
temptrend_abs.sc:microclim.sc
temptrend_abs.sc:mass.sc
temptrend_abs.sc:speed.sc
h_.:REALM2M t_.:-1 t_.:1: t_.:_.:REALM2T
temptrend_abs.sc
REALMMarine
REALMTerrestrial
tsign1
tempave.sc
tempave_metab.sc
seas.sc
microclim.sc
mass.sc
speed.sc
lifespan.sc
consumerfrac.sc
endothermfrac.sc
nspp.sc
npp.sc
veg.sc
temptrend_abs.sc:REALMMarine
temptrend_abs.sc:REALMTerrestrial
temptrend_abs.sc:tsign1
temptrend_abs.sc:tempave.sc
temptrend_abs.sc:tempave_metab.sc
temptrend_abs.sc:seas.sc
temptrend_abs.sc:microclim.sc
temptrend_abs.sc:mass.sc
temptrend_abs.sc:speed.sc
[ reached getOption("max.print") -- omitted 14 rows ]
Standardized Within-Group Residuals:
Min Q1 Med Q3 Max
-7.02311163 -0.26176466 -0.02363408 0.31203019 5.40892698
Number of Observations: 30801
Number of Groups:
STUDY_ID rarefyID %in% STUDY_ID
210 30801
i2 <- trends[, complete.cases(Jbetatrend, REALM, tempave.sc, tempave_metab.sc, seas.sc, microclim.sc,
temptrend.sc, temptrend_abs.sc, mass.sc, speed.sc, lifespan.sc,
consumerfrac.sc, endothermfrac.sc, nspp.sc, thermal_bias.sc, npp.sc, veg.sc, human_bowler.sc)]
i3 <- trends[, complete.cases(Horntrend, REALM, tempave.sc, tempave_metab.sc, seas.sc, microclim.sc,
temptrend.sc, temptrend_abs.sc, mass.sc, speed.sc, lifespan.sc,
consumerfrac.sc, endothermfrac.sc, nspp.sc, thermal_bias.sc, npp.sc, veg.sc, human_bowler.sc)]
randef <- list(STUDY_ID = ~ temptrend_abs.sc, rarefyID = ~1)
varef <- varPower(-0.5, ~nyrBT)
# full models
if(file.exists('temp/modTfullJbeta.rds')){
modTfullJbeta <- readRDS('temp/modTfullJbeta.rds')
} else {
modTfullJbeta <- lme(Jbetatrend ~ temptrend_abs.sc*REALM +
temptrend_abs.sc*tsign +
temptrend_abs.sc*tempave.sc +
temptrend_abs.sc*tempave_metab.sc +
temptrend_abs.sc*seas.sc +
temptrend_abs.sc*microclim.sc +
temptrend_abs.sc*mass.sc +
temptrend_abs.sc*speed.sc +
temptrend_abs.sc*lifespan.sc +
temptrend_abs.sc*consumerfrac.sc +
temptrend_abs.sc*endothermfrac.sc +
temptrend_abs.sc*nspp.sc +
temptrend_abs.sc*thermal_bias.sc:tsign +
temptrend_abs.sc*npp.sc +
temptrend_abs.sc*veg.sc +
temptrend_abs.sc*human_bowler.sc:REALM2,
random = randef, weights = varef, data = trends[i2,], method = 'REML')
saveRDS(modTfullJbeta, file = 'temp/modTfullJbeta.rds')
}
if(file.exists('temp/modTfullHorn.rds')){
modTfullHorn <- readRDS('temp/modTfullHorn.rds')
} else {
modTfullHorn <- lme(Horntrend ~ temptrend_abs.sc*REALM +
temptrend_abs.sc*tsign +
temptrend_abs.sc*tempave.sc +
temptrend_abs.sc*tempave_metab.sc +
temptrend_abs.sc*seas.sc +
temptrend_abs.sc*microclim.sc +
temptrend_abs.sc*mass.sc +
temptrend_abs.sc*speed.sc +
temptrend_abs.sc*lifespan.sc +
temptrend_abs.sc*consumerfrac.sc +
temptrend_abs.sc*endothermfrac.sc +
temptrend_abs.sc*nspp.sc +
temptrend_abs.sc*thermal_bias.sc:tsign +
temptrend_abs.sc*npp.sc +
temptrend_abs.sc*veg.sc +
temptrend_abs.sc*human_bowler.sc:REALM2,
random = randef, weights = varef, data = trends[i3,], method = 'REML')
saveRDS(modTfullHorn, file = 'temp/modTfullHorn.rds')
}
summary(modTfullJbeta)
Linear mixed-effects model fit by REML
Data: trends[i2, ]
Random effects:
Formula: ~temptrend_abs.sc | STUDY_ID
Structure: General positive-definite, Log-Cholesky parametrization
StdDev Corr
(Intercept) 0.06277468 (Intr)
temptrend_abs.sc 0.04847031 -0.175
Formula: ~1 | rarefyID %in% STUDY_ID
(Intercept) Residual
StdDev: 0.0002039828 0.3158091
Variance function:
Structure: Power of variance covariate
Formula: ~nyrBT
Parameter estimates:
power
-1.351927
Fixed effects: Jbetatrend ~ temptrend_abs.sc * REALM + temptrend_abs.sc * tsign + temptrend_abs.sc * tempave.sc + temptrend_abs.sc * tempave_metab.sc + temptrend_abs.sc * seas.sc + temptrend_abs.sc * microclim.sc + temptrend_abs.sc * mass.sc + temptrend_abs.sc * speed.sc + temptrend_abs.sc * lifespan.sc + temptrend_abs.sc * consumerfrac.sc + temptrend_abs.sc * endothermfrac.sc + temptrend_abs.sc * nspp.sc + temptrend_abs.sc * thermal_bias.sc:tsign + temptrend_abs.sc * npp.sc + temptrend_abs.sc * veg.sc + temptrend_abs.sc * human_bowler.sc:REALM2
Correlation:
(Intr) tmpt_. REALMM REALMT tsign1 tmpv.s tmpv_. ses.sc
temptrend_abs.sc -0.430
REALMMarine -0.929 0.402
REALMTerrestrial -0.876 0.377 0.815
tsign1 -0.026 0.017 0.006 0.009
tempave.sc -0.003 0.000 -0.004 -0.005 -0.070
tempave_metab.sc 0.038 -0.020 -0.030 -0.031 -0.022 -0.454
seas.sc -0.030 0.037 0.040 -0.012 -0.107 0.154 -0.084
microclim.sc -0.008 0.018 0.014 -0.006 0.020 -0.060 -0.022 0.127
mass.sc 0.012 0.006 -0.002 -0.002 0.019 0.021 -0.486 0.007
speed.sc 0.000 -0.005 0.009 0.017 -0.049 0.106 -0.277 0.102
lifespan.sc 0.024 -0.019 -0.019 -0.035 -0.015 -0.086 0.707 0.005
consumerfrac.sc -0.003 0.005 0.024 0.252 0.015 -0.044 -0.025 -0.051
endothermfrac.sc 0.133 -0.056 -0.068 -0.269 0.003 0.099 -0.111 0.012
nspp.sc -0.007 -0.011 -0.009 -0.019 -0.038 0.002 -0.023 -0.060
npp.sc 0.004 0.004 -0.005 0.006 0.013 -0.245 0.196 -0.088
veg.sc -0.075 0.119 0.073 -0.004 -0.016 0.141 -0.098 0.121
temptrend_abs.sc:REALMMarine 0.413 -0.960 -0.415 -0.359 -0.004 0.003 0.015 -0.046
temptrend_abs.sc:REALMTerrestrial 0.363 -0.858 -0.336 -0.433 -0.005 -0.011 0.020 0.026
temptrend_abs.sc:tsign1 0.013 -0.037 -0.005 -0.004 -0.484 0.050 -0.002 0.013
temptrend_abs.sc:tempave.sc 0.000 -0.005 -0.002 -0.002 0.052 -0.625 0.315 -0.052
temptrend_abs.sc:tempave_metab.sc -0.009 0.023 0.008 0.010 -0.012 0.335 -0.597 -0.010
temptrend_abs.sc:seas.sc 0.016 -0.050 -0.020 0.021 0.044 0.003 -0.008 -0.647
temptrend_abs.sc:microclim.sc 0.006 -0.026 -0.009 0.007 -0.044 0.089 -0.014 -0.053
temptrend_abs.sc:mass.sc 0.006 -0.010 -0.007 -0.006 -0.015 0.030 0.262 0.008
temptrend_abs.sc:speed.sc -0.004 0.018 -0.003 -0.001 0.026 -0.096 0.128 -0.035
mcrcl. mss.sc spd.sc lfspn. cnsmr. endth. nspp.s npp.sc
temptrend_abs.sc
REALMMarine
REALMTerrestrial
tsign1
tempave.sc
tempave_metab.sc
seas.sc
microclim.sc
mass.sc 0.056
speed.sc 0.072 0.129
lifespan.sc -0.027 -0.760 -0.455
consumerfrac.sc -0.001 0.014 -0.049 -0.047
endothermfrac.sc 0.009 0.001 -0.142 0.068 -0.328
nspp.sc -0.115 -0.208 0.014 0.134 -0.009 0.067
npp.sc -0.090 -0.044 0.048 0.035 -0.029 -0.049 -0.182
veg.sc -0.019 0.034 0.052 -0.029 -0.069 -0.012 0.002 -0.271
temptrend_abs.sc:REALMMarine -0.022 -0.010 -0.005 0.014 -0.010 0.036 0.020 0.008
temptrend_abs.sc:REALMTerrestrial 0.010 -0.008 -0.006 0.023 -0.100 0.135 0.031 -0.018
temptrend_abs.sc:tsign1 -0.041 -0.015 0.019 0.008 -0.004 0.006 0.025 -0.048
temptrend_abs.sc:tempave.sc 0.083 0.028 -0.064 0.031 -0.009 -0.087 -0.016 0.157
temptrend_abs.sc:tempave_metab.sc -0.034 0.244 0.069 -0.350 0.049 0.105 -0.006 -0.141
temptrend_abs.sc:seas.sc -0.088 0.007 -0.037 -0.005 0.041 0.019 0.040 0.061
temptrend_abs.sc:microclim.sc -0.693 -0.028 -0.029 0.018 0.002 0.009 0.045 0.103
temptrend_abs.sc:mass.sc -0.017 -0.555 -0.024 0.434 -0.005 0.014 0.131 0.005
temptrend_abs.sc:speed.sc -0.041 -0.044 -0.547 0.187 0.022 0.079 -0.024 0.006
veg.sc t_.:REALMM t_.:REALMT tm_.:1 tmptrnd_bs.sc:t.
temptrend_abs.sc
REALMMarine
REALMTerrestrial
tsign1
tempave.sc
tempave_metab.sc
seas.sc
microclim.sc
mass.sc
speed.sc
lifespan.sc
consumerfrac.sc
endothermfrac.sc
nspp.sc
npp.sc
veg.sc
temptrend_abs.sc:REALMMarine -0.129
temptrend_abs.sc:REALMTerrestrial 0.005 0.814
temptrend_abs.sc:tsign1 -0.004 0.012 0.007
temptrend_abs.sc:tempave.sc -0.140 -0.001 0.017 -0.076
temptrend_abs.sc:tempave_metab.sc 0.060 -0.019 -0.030 0.015 -0.420
temptrend_abs.sc:seas.sc -0.127 0.068 -0.052 -0.018 0.060
temptrend_abs.sc:microclim.sc 0.024 0.030 -0.023 0.047 -0.119
temptrend_abs.sc:mass.sc -0.005 0.016 0.018 0.026 -0.073
temptrend_abs.sc:speed.sc -0.057 0.001 0.000 -0.006 0.161
tm_.:_. tmptrnd_bs.sc:ss. tmptrnd_bs.sc:mc.
temptrend_abs.sc
REALMMarine
REALMTerrestrial
tsign1
tempave.sc
tempave_metab.sc
seas.sc
microclim.sc
mass.sc
speed.sc
lifespan.sc
consumerfrac.sc
endothermfrac.sc
nspp.sc
npp.sc
veg.sc
temptrend_abs.sc:REALMMarine
temptrend_abs.sc:REALMTerrestrial
temptrend_abs.sc:tsign1
temptrend_abs.sc:tempave.sc
temptrend_abs.sc:tempave_metab.sc
temptrend_abs.sc:seas.sc 0.031
temptrend_abs.sc:microclim.sc 0.104 0.139
temptrend_abs.sc:mass.sc -0.469 -0.045 -0.010
temptrend_abs.sc:speed.sc -0.223 0.074 0.046
tmptrnd_bs.sc:ms. tmptrnd_bs.sc:sp. tmptrnd_bs.sc:l.
temptrend_abs.sc
REALMMarine
REALMTerrestrial
tsign1
tempave.sc
tempave_metab.sc
seas.sc
microclim.sc
mass.sc
speed.sc
lifespan.sc
consumerfrac.sc
endothermfrac.sc
nspp.sc
npp.sc
veg.sc
temptrend_abs.sc:REALMMarine
temptrend_abs.sc:REALMTerrestrial
temptrend_abs.sc:tsign1
temptrend_abs.sc:tempave.sc
temptrend_abs.sc:tempave_metab.sc
temptrend_abs.sc:seas.sc
temptrend_abs.sc:microclim.sc
temptrend_abs.sc:mass.sc
temptrend_abs.sc:speed.sc 0.063
tmptrnd_bs.sc:c. tmptrnd_bs.sc:nd. tmptrnd_bs.sc:ns.
temptrend_abs.sc
REALMMarine
REALMTerrestrial
tsign1
tempave.sc
tempave_metab.sc
seas.sc
microclim.sc
mass.sc
speed.sc
lifespan.sc
consumerfrac.sc
endothermfrac.sc
nspp.sc
npp.sc
veg.sc
temptrend_abs.sc:REALMMarine
temptrend_abs.sc:REALMTerrestrial
temptrend_abs.sc:tsign1
temptrend_abs.sc:tempave.sc
temptrend_abs.sc:tempave_metab.sc
temptrend_abs.sc:seas.sc
temptrend_abs.sc:microclim.sc
temptrend_abs.sc:mass.sc
temptrend_abs.sc:speed.sc
t-1:_. ts1:_. tmptrnd_bs.sc:np. tmptrnd_bs.sc:v.
temptrend_abs.sc
REALMMarine
REALMTerrestrial
tsign1
tempave.sc
tempave_metab.sc
seas.sc
microclim.sc
mass.sc
speed.sc
lifespan.sc
consumerfrac.sc
endothermfrac.sc
nspp.sc
npp.sc
veg.sc
temptrend_abs.sc:REALMMarine
temptrend_abs.sc:REALMTerrestrial
temptrend_abs.sc:tsign1
temptrend_abs.sc:tempave.sc
temptrend_abs.sc:tempave_metab.sc
temptrend_abs.sc:seas.sc
temptrend_abs.sc:microclim.sc
temptrend_abs.sc:mass.sc
temptrend_abs.sc:speed.sc
h_.:REALM2T h_.:REALM2M t_.:-1 t_.:1: t_.:_.:REALM2T
temptrend_abs.sc
REALMMarine
REALMTerrestrial
tsign1
tempave.sc
tempave_metab.sc
seas.sc
microclim.sc
mass.sc
speed.sc
lifespan.sc
consumerfrac.sc
endothermfrac.sc
nspp.sc
npp.sc
veg.sc
temptrend_abs.sc:REALMMarine
temptrend_abs.sc:REALMTerrestrial
temptrend_abs.sc:tsign1
temptrend_abs.sc:tempave.sc
temptrend_abs.sc:tempave_metab.sc
temptrend_abs.sc:seas.sc
temptrend_abs.sc:microclim.sc
temptrend_abs.sc:mass.sc
temptrend_abs.sc:speed.sc
[ reached getOption("max.print") -- omitted 14 rows ]
Standardized Within-Group Residuals:
Min Q1 Med Q3 Max
-7.3991424 -0.2444604 0.1291713 0.6077538 6.7430991
Number of Observations: 43493
Number of Groups:
STUDY_ID rarefyID %in% STUDY_ID
235 43493
summary(modTfullHorn)
Linear mixed-effects model fit by REML
Data: trends[i3, ]
Random effects:
Formula: ~temptrend_abs.sc | STUDY_ID
Structure: General positive-definite, Log-Cholesky parametrization
StdDev Corr
(Intercept) 0.06157166 (Intr)
temptrend_abs.sc 0.04045651 -0.087
Formula: ~1 | rarefyID %in% STUDY_ID
(Intercept) Residual
StdDev: 0.004171557 0.2960534
Variance function:
Structure: Power of variance covariate
Formula: ~nyrBT
Parameter estimates:
power
-1.223338
Fixed effects: Horntrend ~ temptrend_abs.sc * REALM + temptrend_abs.sc * tsign + temptrend_abs.sc * tempave.sc + temptrend_abs.sc * tempave_metab.sc + temptrend_abs.sc * seas.sc + temptrend_abs.sc * microclim.sc + temptrend_abs.sc * mass.sc + temptrend_abs.sc * speed.sc + temptrend_abs.sc * lifespan.sc + temptrend_abs.sc * consumerfrac.sc + temptrend_abs.sc * endothermfrac.sc + temptrend_abs.sc * nspp.sc + temptrend_abs.sc * thermal_bias.sc:tsign + temptrend_abs.sc * npp.sc + temptrend_abs.sc * veg.sc + temptrend_abs.sc * human_bowler.sc:REALM2
Correlation:
(Intr) tmpt_. REALMM REALMT tsign1 tmpv.s tmpv_. ses.sc
temptrend_abs.sc -0.380
REALMMarine -0.917 0.352
REALMTerrestrial -0.858 0.326 0.781
tsign1 -0.032 0.020 0.007 0.013
tempave.sc -0.007 0.003 0.004 -0.005 -0.074
tempave_metab.sc 0.050 -0.023 -0.042 -0.039 -0.022 -0.506
seas.sc -0.043 0.037 0.059 -0.014 -0.114 0.205 -0.112
microclim.sc -0.017 0.022 0.025 -0.007 0.006 -0.034 -0.034 0.148
mass.sc 0.012 0.010 -0.001 0.003 0.021 0.023 -0.485 -0.004
speed.sc 0.005 -0.005 0.011 0.013 -0.049 0.105 -0.269 0.097
lifespan.sc 0.029 -0.020 -0.024 -0.040 -0.015 -0.087 0.691 0.018
consumerfrac.sc -0.004 0.007 0.002 0.268 0.019 -0.026 -0.021 -0.047
endothermfrac.sc 0.142 -0.048 -0.069 -0.299 0.004 0.153 -0.163 0.037
nspp.sc -0.010 -0.017 -0.009 -0.023 -0.031 0.016 -0.021 -0.019
npp.sc 0.015 0.004 -0.018 0.009 0.011 -0.292 0.228 -0.205
veg.sc -0.110 0.123 0.112 -0.003 -0.017 0.148 -0.106 0.135
temptrend_abs.sc:REALMMarine 0.364 -0.957 -0.362 -0.306 -0.006 -0.005 0.019 -0.048
temptrend_abs.sc:REALMTerrestrial 0.313 -0.840 -0.285 -0.387 -0.006 -0.008 0.025 0.041
temptrend_abs.sc:tsign1 0.016 -0.044 -0.006 -0.005 -0.489 0.042 0.003 0.015
temptrend_abs.sc:tempave.sc 0.004 -0.009 -0.008 -0.002 0.050 -0.571 0.306 -0.056
temptrend_abs.sc:tempave_metab.sc -0.014 0.028 0.013 0.016 -0.010 0.316 -0.574 -0.007
temptrend_abs.sc:seas.sc 0.018 -0.056 -0.025 0.029 0.045 -0.031 0.006 -0.606
temptrend_abs.sc:microclim.sc 0.009 -0.026 -0.012 0.007 -0.038 0.064 -0.005 -0.075
temptrend_abs.sc:mass.sc 0.007 -0.017 -0.008 -0.011 -0.013 0.021 0.260 0.005
temptrend_abs.sc:speed.sc -0.004 0.020 -0.005 -0.001 0.025 -0.081 0.123 -0.028
mcrcl. mss.sc spd.sc lfspn. cnsmr. endth. nspp.s npp.sc
temptrend_abs.sc
REALMMarine
REALMTerrestrial
tsign1
tempave.sc
tempave_metab.sc
seas.sc
microclim.sc
mass.sc 0.023
speed.sc 0.063 0.148
lifespan.sc 0.003 -0.778 -0.448
consumerfrac.sc -0.006 0.014 -0.062 -0.040
endothermfrac.sc 0.018 -0.011 -0.145 0.060 -0.317
nspp.sc -0.081 -0.222 0.000 0.149 -0.004 0.083
npp.sc -0.224 -0.034 0.046 0.028 -0.014 -0.083 -0.195
veg.sc 0.022 0.028 0.040 -0.022 -0.049 0.013 0.014 -0.276
temptrend_abs.sc:REALMMarine -0.025 -0.014 -0.007 0.015 -0.008 0.032 0.025 0.011
temptrend_abs.sc:REALMTerrestrial 0.012 -0.018 -0.004 0.027 -0.085 0.133 0.041 -0.024
temptrend_abs.sc:tsign1 -0.036 -0.013 0.018 0.007 -0.006 0.004 0.024 -0.046
temptrend_abs.sc:tempave.sc 0.076 0.025 -0.061 0.030 -0.011 -0.099 -0.017 0.144
temptrend_abs.sc:tempave_metab.sc -0.017 0.248 0.078 -0.347 0.050 0.120 -0.005 -0.142
temptrend_abs.sc:seas.sc -0.101 0.009 -0.035 -0.011 0.032 0.002 0.016 0.109
temptrend_abs.sc:microclim.sc -0.660 -0.008 -0.026 0.001 0.003 0.001 0.033 0.155
temptrend_abs.sc:mass.sc -0.008 -0.552 -0.034 0.435 -0.012 0.019 0.131 0.007
temptrend_abs.sc:speed.sc -0.034 -0.047 -0.533 0.186 0.020 0.084 -0.017 -0.001
veg.sc t_.:REALMM t_.:REALMT tm_.:1 tmptrnd_bs.sc:t.
temptrend_abs.sc
REALMMarine
REALMTerrestrial
tsign1
tempave.sc
tempave_metab.sc
seas.sc
microclim.sc
mass.sc
speed.sc
lifespan.sc
consumerfrac.sc
endothermfrac.sc
nspp.sc
npp.sc
veg.sc
temptrend_abs.sc:REALMMarine -0.136
temptrend_abs.sc:REALMTerrestrial 0.013 0.789
temptrend_abs.sc:tsign1 0.003 0.014 0.009
temptrend_abs.sc:tempave.sc -0.130 0.008 0.018 -0.068
temptrend_abs.sc:tempave_metab.sc 0.057 -0.021 -0.050 0.012 -0.434
temptrend_abs.sc:seas.sc -0.131 0.076 -0.080 -0.020 0.034
temptrend_abs.sc:microclim.sc 0.021 0.030 -0.029 0.050 -0.144
temptrend_abs.sc:mass.sc -0.001 0.021 0.033 0.025 -0.080
temptrend_abs.sc:speed.sc -0.047 0.004 -0.002 -0.004 0.162
tm_.:_. tmptrnd_bs.sc:ss. tmptrnd_bs.sc:mc.
temptrend_abs.sc
REALMMarine
REALMTerrestrial
tsign1
tempave.sc
tempave_metab.sc
seas.sc
microclim.sc
mass.sc
speed.sc
lifespan.sc
consumerfrac.sc
endothermfrac.sc
nspp.sc
npp.sc
veg.sc
temptrend_abs.sc:REALMMarine
temptrend_abs.sc:REALMTerrestrial
temptrend_abs.sc:tsign1
temptrend_abs.sc:tempave.sc
temptrend_abs.sc:tempave_metab.sc
temptrend_abs.sc:seas.sc 0.052
temptrend_abs.sc:microclim.sc 0.103 0.138
temptrend_abs.sc:mass.sc -0.465 -0.040 -0.008
temptrend_abs.sc:speed.sc -0.216 0.064 0.039
tmptrnd_bs.sc:ms. tmptrnd_bs.sc:sp. tmptrnd_bs.sc:l.
temptrend_abs.sc
REALMMarine
REALMTerrestrial
tsign1
tempave.sc
tempave_metab.sc
seas.sc
microclim.sc
mass.sc
speed.sc
lifespan.sc
consumerfrac.sc
endothermfrac.sc
nspp.sc
npp.sc
veg.sc
temptrend_abs.sc:REALMMarine
temptrend_abs.sc:REALMTerrestrial
temptrend_abs.sc:tsign1
temptrend_abs.sc:tempave.sc
temptrend_abs.sc:tempave_metab.sc
temptrend_abs.sc:seas.sc
temptrend_abs.sc:microclim.sc
temptrend_abs.sc:mass.sc
temptrend_abs.sc:speed.sc 0.058
tmptrnd_bs.sc:c. tmptrnd_bs.sc:nd. tmptrnd_bs.sc:ns.
temptrend_abs.sc
REALMMarine
REALMTerrestrial
tsign1
tempave.sc
tempave_metab.sc
seas.sc
microclim.sc
mass.sc
speed.sc
lifespan.sc
consumerfrac.sc
endothermfrac.sc
nspp.sc
npp.sc
veg.sc
temptrend_abs.sc:REALMMarine
temptrend_abs.sc:REALMTerrestrial
temptrend_abs.sc:tsign1
temptrend_abs.sc:tempave.sc
temptrend_abs.sc:tempave_metab.sc
temptrend_abs.sc:seas.sc
temptrend_abs.sc:microclim.sc
temptrend_abs.sc:mass.sc
temptrend_abs.sc:speed.sc
t-1:_. ts1:_. tmptrnd_bs.sc:np. tmptrnd_bs.sc:v.
temptrend_abs.sc
REALMMarine
REALMTerrestrial
tsign1
tempave.sc
tempave_metab.sc
seas.sc
microclim.sc
mass.sc
speed.sc
lifespan.sc
consumerfrac.sc
endothermfrac.sc
nspp.sc
npp.sc
veg.sc
temptrend_abs.sc:REALMMarine
temptrend_abs.sc:REALMTerrestrial
temptrend_abs.sc:tsign1
temptrend_abs.sc:tempave.sc
temptrend_abs.sc:tempave_metab.sc
temptrend_abs.sc:seas.sc
temptrend_abs.sc:microclim.sc
temptrend_abs.sc:mass.sc
temptrend_abs.sc:speed.sc
h_.:REALM2T h_.:REALM2M t_.:-1 t_.:1: t_.:_.:REALM2T
temptrend_abs.sc
REALMMarine
REALMTerrestrial
tsign1
tempave.sc
tempave_metab.sc
seas.sc
microclim.sc
mass.sc
speed.sc
lifespan.sc
consumerfrac.sc
endothermfrac.sc
nspp.sc
npp.sc
veg.sc
temptrend_abs.sc:REALMMarine
temptrend_abs.sc:REALMTerrestrial
temptrend_abs.sc:tsign1
temptrend_abs.sc:tempave.sc
temptrend_abs.sc:tempave_metab.sc
temptrend_abs.sc:seas.sc
temptrend_abs.sc:microclim.sc
temptrend_abs.sc:mass.sc
temptrend_abs.sc:speed.sc
[ reached getOption("max.print") -- omitted 14 rows ]
Standardized Within-Group Residuals:
Min Q1 Med Q3 Max
-6.73851930 -0.38297739 0.03926292 0.54007605 6.19209050
Number of Observations: 42493
Number of Groups:
STUDY_ID rarefyID %in% STUDY_ID
202 42493
i2 <- trends[, complete.cases(Jbetatrendrem0, REALM, tempave.sc, tempave_metab.sc, seas.sc, microclim.sc,
temptrend.sc, temptrend_abs.sc, mass.sc, speed.sc, lifespan.sc,
consumerfrac.sc, endothermfrac.sc, nspp.sc, thermal_bias.sc, npp.sc,
veg.sc, human_bowler.sc)]
i3 <- trends[, complete.cases(Horntrendrem0, REALM, tempave.sc, tempave_metab.sc, seas.sc, microclim.sc,
temptrend.sc, temptrend_abs.sc, mass.sc, speed.sc, lifespan.sc,
consumerfrac.sc, endothermfrac.sc, nspp.sc, thermal_bias.sc, npp.sc,
veg.sc, human_bowler.sc)]
randef <- list(STUDY_ID = ~ temptrend_abs.sc, rarefyID = ~1)
varef <- varPower(-0.5, ~nyrBT)
# full models
if(file.exists('temp/modTfullJbetarem0.rds')){
modTfullJbetarem0 <- readRDS('temp/modTfullJbetarem0.rds')
} else {
modTfullJbetarem0 <- lme(Jbetatrendrem0 ~ temptrend_abs.sc*REALM +
temptrend_abs.sc*tsign +
temptrend_abs.sc*tempave.sc +
temptrend_abs.sc*tempave_metab.sc +
temptrend_abs.sc*seas.sc +
temptrend_abs.sc*microclim.sc +
temptrend_abs.sc*mass.sc +
temptrend_abs.sc*speed.sc +
temptrend_abs.sc*lifespan.sc +
temptrend_abs.sc*consumerfrac.sc +
temptrend_abs.sc*endothermfrac.sc +
temptrend_abs.sc*nspp.sc +
temptrend_abs.sc*thermal_bias.sc:tsign +
temptrend_abs.sc*npp.sc +
temptrend_abs.sc*veg.sc +
temptrend_abs.sc*human_bowler.sc:REALM2,
random = randef, weights = varef, data = trends[i2,], method = 'REML')
saveRDS(modTfullJbetarem0, file = 'temp/modTfullJbetarem0.rds')
}
if(file.exists('temp/modTfullHornrem0.rds')){
modTfullHornrem0 <- readRDS('temp/modTfullHornrem0.rds')
} else {
modTfullHornrem0 <- lme(Horntrendrem0 ~ temptrend_abs.sc*REALM +
temptrend_abs.sc*tsign +
temptrend_abs.sc*tempave.sc +
temptrend_abs.sc*tempave_metab.sc +
temptrend_abs.sc*seas.sc +
temptrend_abs.sc*microclim.sc +
temptrend_abs.sc*mass.sc +
temptrend_abs.sc*speed.sc +
temptrend_abs.sc*lifespan.sc +
temptrend_abs.sc*consumerfrac.sc +
temptrend_abs.sc*endothermfrac.sc +
temptrend_abs.sc*nspp.sc +
temptrend_abs.sc*thermal_bias.sc:tsign +
temptrend_abs.sc*npp.sc +
temptrend_abs.sc*veg.sc +
temptrend_abs.sc*human_bowler.sc:REALM2,
random = randef, weights = varef, data = trends[i3,], method = 'REML')
saveRDS(modTfullHornrem0, file = 'temp/modTfullHornrem0.rds')
}
summary(modTfullJbetarem0)
Linear mixed-effects model fit by REML
Data: trends[i2, ]
Random effects:
Formula: ~temptrend_abs.sc | STUDY_ID
Structure: General positive-definite, Log-Cholesky parametrization
StdDev Corr
(Intercept) 0.007723766 (Intr)
temptrend_abs.sc 0.017251054 0.308
Formula: ~1 | rarefyID %in% STUDY_ID
(Intercept) Residual
StdDev: 0.002065633 0.8886333
Variance function:
Structure: Power of variance covariate
Formula: ~nyrBT
Parameter estimates:
power
-1.821858
Fixed effects: Jbetatrendrem0 ~ temptrend_abs.sc * REALM + temptrend_abs.sc * tsign + temptrend_abs.sc * tempave.sc + temptrend_abs.sc * tempave_metab.sc + temptrend_abs.sc * seas.sc + temptrend_abs.sc * microclim.sc + temptrend_abs.sc * mass.sc + temptrend_abs.sc * speed.sc + temptrend_abs.sc * lifespan.sc + temptrend_abs.sc * consumerfrac.sc + temptrend_abs.sc * endothermfrac.sc + temptrend_abs.sc * nspp.sc + temptrend_abs.sc * thermal_bias.sc:tsign + temptrend_abs.sc * npp.sc + temptrend_abs.sc * veg.sc + temptrend_abs.sc * human_bowler.sc:REALM2
Correlation:
(Intr) tmpt_. REALMM REALMT tsign1 tmpv.s tmpv_. ses.sc
temptrend_abs.sc -0.478
REALMMarine -0.934 0.465
REALMTerrestrial -0.741 0.288 0.680
tsign1 -0.146 0.068 0.034 0.026
tempave.sc -0.017 0.007 0.026 0.004 -0.065
tempave_metab.sc 0.112 -0.049 -0.117 -0.071 -0.010 -0.547
seas.sc -0.110 0.070 0.160 -0.073 -0.106 0.226 -0.089
microclim.sc -0.080 0.087 0.098 -0.015 0.037 0.017 -0.069 0.169
mass.sc -0.007 0.052 0.022 0.050 0.018 0.006 -0.496 0.013
speed.sc 0.055 -0.033 0.000 -0.033 -0.049 0.067 -0.217 0.066
lifespan.sc 0.077 -0.060 -0.084 -0.079 -0.032 -0.048 0.639 0.030
consumerfrac.sc -0.071 0.042 0.040 0.330 0.042 0.014 -0.042 -0.100
endothermfrac.sc 0.029 -0.005 -0.009 -0.257 0.023 0.415 -0.481 0.093
nspp.sc 0.023 -0.070 -0.086 -0.114 -0.036 0.016 -0.007 -0.085
npp.sc 0.025 -0.006 -0.048 0.037 0.009 -0.246 0.231 -0.094
veg.sc -0.381 0.387 0.407 0.005 -0.005 0.139 -0.130 0.096
temptrend_abs.sc:REALMMarine 0.464 -0.954 -0.469 -0.267 -0.020 -0.026 0.050 -0.091
temptrend_abs.sc:REALMTerrestrial 0.283 -0.720 -0.262 -0.428 -0.011 0.000 0.026 0.119
temptrend_abs.sc:tsign1 0.082 -0.138 -0.035 -0.012 -0.510 0.078 -0.015 0.029
temptrend_abs.sc:tempave.sc 0.038 -0.019 -0.054 -0.007 0.062 -0.717 0.425 -0.187
temptrend_abs.sc:tempave_metab.sc -0.045 0.059 0.048 0.037 -0.019 0.425 -0.673 0.028
temptrend_abs.sc:seas.sc 0.068 -0.098 -0.097 0.099 0.064 -0.129 0.041 -0.738
temptrend_abs.sc:microclim.sc 0.072 -0.116 -0.083 0.019 -0.046 0.023 0.035 -0.104
temptrend_abs.sc:mass.sc 0.033 -0.041 -0.035 -0.047 -0.016 0.030 0.289 0.010
temptrend_abs.sc:speed.sc -0.051 0.053 0.023 0.056 0.037 -0.060 0.131 -0.016
mcrcl. mss.sc spd.sc lfspn. cnsmr. endth. nspp.s npp.sc
temptrend_abs.sc
REALMMarine
REALMTerrestrial
tsign1
tempave.sc
tempave_metab.sc
seas.sc
microclim.sc
mass.sc 0.015
speed.sc 0.062 0.112
lifespan.sc -0.003 -0.825 -0.385
consumerfrac.sc -0.023 0.069 -0.267 -0.032
endothermfrac.sc 0.049 -0.088 -0.300 0.111 -0.140
nspp.sc -0.122 -0.171 0.015 0.167 -0.033 0.165
npp.sc -0.189 -0.032 0.046 0.029 -0.034 -0.184 -0.168
veg.sc 0.032 0.046 0.048 -0.054 -0.017 0.065 0.008 -0.286
temptrend_abs.sc:REALMMarine -0.092 -0.053 0.004 0.058 -0.025 0.011 0.096 0.047
temptrend_abs.sc:REALMTerrestrial 0.026 -0.060 0.040 0.051 -0.152 0.098 0.114 -0.055
temptrend_abs.sc:tsign1 -0.033 -0.017 0.018 0.024 -0.021 0.011 0.022 -0.043
temptrend_abs.sc:tempave.sc 0.013 0.028 -0.033 0.006 -0.010 -0.354 -0.023 0.183
temptrend_abs.sc:tempave_metab.sc -0.006 0.293 0.089 -0.371 0.066 0.370 -0.006 -0.172
temptrend_abs.sc:seas.sc -0.125 0.002 -0.026 -0.027 0.089 -0.059 0.069 0.083
temptrend_abs.sc:microclim.sc -0.813 -0.004 -0.036 0.002 0.009 -0.025 0.074 0.192
temptrend_abs.sc:mass.sc 0.017 -0.596 -0.044 0.507 -0.051 0.058 0.114 -0.015
temptrend_abs.sc:speed.sc -0.030 -0.061 -0.608 0.192 0.182 0.164 -0.045 0.001
veg.sc t_.:REALMM t_.:REALMT tm_.:1 tmptrnd_bs.sc:t.
temptrend_abs.sc
REALMMarine
REALMTerrestrial
tsign1
tempave.sc
tempave_metab.sc
seas.sc
microclim.sc
mass.sc
speed.sc
lifespan.sc
consumerfrac.sc
endothermfrac.sc
nspp.sc
npp.sc
veg.sc
temptrend_abs.sc:REALMMarine -0.417
temptrend_abs.sc:REALMTerrestrial 0.019 0.665
temptrend_abs.sc:tsign1 -0.021 0.049 0.014
temptrend_abs.sc:tempave.sc -0.133 0.045 -0.012 -0.101
temptrend_abs.sc:tempave_metab.sc 0.095 -0.060 -0.056 0.029 -0.454
temptrend_abs.sc:seas.sc -0.095 0.138 -0.175 -0.045 0.263
temptrend_abs.sc:microclim.sc -0.052 0.126 -0.043 0.031 -0.023
temptrend_abs.sc:mass.sc -0.014 0.049 0.086 0.021 -0.045
temptrend_abs.sc:speed.sc -0.042 -0.007 -0.034 -0.014 0.090
tm_.:_. tmptrnd_bs.sc:ss. tmptrnd_bs.sc:mc.
temptrend_abs.sc
REALMMarine
REALMTerrestrial
tsign1
tempave.sc
tempave_metab.sc
seas.sc
microclim.sc
mass.sc
speed.sc
lifespan.sc
consumerfrac.sc
endothermfrac.sc
nspp.sc
npp.sc
veg.sc
temptrend_abs.sc:REALMMarine
temptrend_abs.sc:REALMTerrestrial
temptrend_abs.sc:tsign1
temptrend_abs.sc:tempave.sc
temptrend_abs.sc:tempave_metab.sc
temptrend_abs.sc:seas.sc -0.042
temptrend_abs.sc:microclim.sc 0.058 0.170
temptrend_abs.sc:mass.sc -0.521 -0.043 -0.039
temptrend_abs.sc:speed.sc -0.261 0.070 0.040
tmptrnd_bs.sc:ms. tmptrnd_bs.sc:sp. tmptrnd_bs.sc:l.
temptrend_abs.sc
REALMMarine
REALMTerrestrial
tsign1
tempave.sc
tempave_metab.sc
seas.sc
microclim.sc
mass.sc
speed.sc
lifespan.sc
consumerfrac.sc
endothermfrac.sc
nspp.sc
npp.sc
veg.sc
temptrend_abs.sc:REALMMarine
temptrend_abs.sc:REALMTerrestrial
temptrend_abs.sc:tsign1
temptrend_abs.sc:tempave.sc
temptrend_abs.sc:tempave_metab.sc
temptrend_abs.sc:seas.sc
temptrend_abs.sc:microclim.sc
temptrend_abs.sc:mass.sc
temptrend_abs.sc:speed.sc 0.125
tmptrnd_bs.sc:c. tmptrnd_bs.sc:nd. tmptrnd_bs.sc:ns.
temptrend_abs.sc
REALMMarine
REALMTerrestrial
tsign1
tempave.sc
tempave_metab.sc
seas.sc
microclim.sc
mass.sc
speed.sc
lifespan.sc
consumerfrac.sc
endothermfrac.sc
nspp.sc
npp.sc
veg.sc
temptrend_abs.sc:REALMMarine
temptrend_abs.sc:REALMTerrestrial
temptrend_abs.sc:tsign1
temptrend_abs.sc:tempave.sc
temptrend_abs.sc:tempave_metab.sc
temptrend_abs.sc:seas.sc
temptrend_abs.sc:microclim.sc
temptrend_abs.sc:mass.sc
temptrend_abs.sc:speed.sc
t-1:_. ts1:_. tmptrnd_bs.sc:np. tmptrnd_bs.sc:v.
temptrend_abs.sc
REALMMarine
REALMTerrestrial
tsign1
tempave.sc
tempave_metab.sc
seas.sc
microclim.sc
mass.sc
speed.sc
lifespan.sc
consumerfrac.sc
endothermfrac.sc
nspp.sc
npp.sc
veg.sc
temptrend_abs.sc:REALMMarine
temptrend_abs.sc:REALMTerrestrial
temptrend_abs.sc:tsign1
temptrend_abs.sc:tempave.sc
temptrend_abs.sc:tempave_metab.sc
temptrend_abs.sc:seas.sc
temptrend_abs.sc:microclim.sc
temptrend_abs.sc:mass.sc
temptrend_abs.sc:speed.sc
h_.:REALM2T h_.:REALM2M t_.:-1 t_.:1: t_.:_.:REALM2T
temptrend_abs.sc
REALMMarine
REALMTerrestrial
tsign1
tempave.sc
tempave_metab.sc
seas.sc
microclim.sc
mass.sc
speed.sc
lifespan.sc
consumerfrac.sc
endothermfrac.sc
nspp.sc
npp.sc
veg.sc
temptrend_abs.sc:REALMMarine
temptrend_abs.sc:REALMTerrestrial
temptrend_abs.sc:tsign1
temptrend_abs.sc:tempave.sc
temptrend_abs.sc:tempave_metab.sc
temptrend_abs.sc:seas.sc
temptrend_abs.sc:microclim.sc
temptrend_abs.sc:mass.sc
temptrend_abs.sc:speed.sc
[ reached getOption("max.print") -- omitted 14 rows ]
Standardized Within-Group Residuals:
Min Q1 Med Q3 Max
-8.38808782 -0.33122885 -0.03014344 0.33937884 8.28289240
Number of Observations: 31072
Number of Groups:
STUDY_ID rarefyID %in% STUDY_ID
218 31072
summary(modTfullHornrem0)
Linear mixed-effects model fit by REML
Data: trends[i3, ]
Random effects:
Formula: ~temptrend_abs.sc | STUDY_ID
Structure: General positive-definite, Log-Cholesky parametrization
StdDev Corr
(Intercept) 0.01569909 (Intr)
temptrend_abs.sc 0.02631579 0.237
Formula: ~1 | rarefyID %in% STUDY_ID
(Intercept) Residual
StdDev: 0.01343706 2.039905
Variance function:
Structure: Power of variance covariate
Formula: ~nyrBT
Parameter estimates:
power
-2.179888
Fixed effects: Horntrendrem0 ~ temptrend_abs.sc * REALM + temptrend_abs.sc * tsign + temptrend_abs.sc * tempave.sc + temptrend_abs.sc * tempave_metab.sc + temptrend_abs.sc * seas.sc + temptrend_abs.sc * microclim.sc + temptrend_abs.sc * mass.sc + temptrend_abs.sc * speed.sc + temptrend_abs.sc * lifespan.sc + temptrend_abs.sc * consumerfrac.sc + temptrend_abs.sc * endothermfrac.sc + temptrend_abs.sc * nspp.sc + temptrend_abs.sc * thermal_bias.sc:tsign + temptrend_abs.sc * npp.sc + temptrend_abs.sc * veg.sc + temptrend_abs.sc * human_bowler.sc:REALM2
Correlation:
(Intr) tmpt_. REALMM REALMT tsign1 tmpv.s tmpv_. ses.sc
temptrend_abs.sc -0.438
REALMMarine -0.942 0.425
REALMTerrestrial -0.717 0.272 0.656
tsign1 -0.095 0.060 0.014 0.023
tempave.sc -0.036 0.014 0.042 0.012 -0.061
tempave_metab.sc 0.103 -0.038 -0.100 -0.082 -0.013 -0.662
seas.sc -0.121 0.053 0.165 -0.099 -0.110 0.213 -0.074
microclim.sc -0.059 0.048 0.071 -0.017 0.031 -0.034 -0.041 0.086
mass.sc -0.011 0.037 0.026 0.054 0.018 0.012 -0.444 0.018
speed.sc 0.043 -0.028 0.007 -0.004 -0.052 0.097 -0.214 0.063
lifespan.sc 0.066 -0.045 -0.071 -0.091 -0.028 -0.068 0.589 0.034
consumerfrac.sc -0.039 0.034 0.014 0.296 0.046 0.028 -0.063 -0.117
endothermfrac.sc 0.023 -0.004 -0.009 -0.236 0.021 0.518 -0.551 0.084
nspp.sc 0.011 -0.066 -0.061 -0.107 -0.007 0.042 -0.014 -0.020
npp.sc 0.032 0.013 -0.047 0.061 -0.005 -0.240 0.209 -0.205
veg.sc -0.477 0.315 0.495 0.019 -0.012 0.128 -0.102 0.111
temptrend_abs.sc:REALMMarine 0.427 -0.953 -0.430 -0.254 -0.020 -0.026 0.035 -0.066
temptrend_abs.sc:REALMTerrestrial 0.248 -0.695 -0.230 -0.416 -0.007 -0.007 0.038 0.147
temptrend_abs.sc:tsign1 0.055 -0.120 -0.018 -0.002 -0.517 0.056 -0.013 0.012
temptrend_abs.sc:tempave.sc 0.041 -0.032 -0.053 -0.020 0.055 -0.610 0.405 -0.103
temptrend_abs.sc:tempave_metab.sc -0.040 0.042 0.037 0.044 -0.016 0.396 -0.626 -0.013
temptrend_abs.sc:seas.sc 0.060 -0.096 -0.082 0.125 0.057 -0.096 0.017 -0.661
temptrend_abs.sc:microclim.sc 0.026 -0.062 -0.033 0.015 -0.052 0.052 0.003 -0.032
temptrend_abs.sc:mass.sc 0.026 -0.038 -0.028 -0.039 -0.011 0.028 0.250 -0.003
temptrend_abs.sc:speed.sc -0.026 0.046 0.004 0.032 0.034 -0.054 0.118 -0.004
mcrcl. mss.sc spd.sc lfspn. cnsmr. endth. nspp.s npp.sc
temptrend_abs.sc
REALMMarine
REALMTerrestrial
tsign1
tempave.sc
tempave_metab.sc
seas.sc
microclim.sc
mass.sc 0.013
speed.sc 0.058 0.153
lifespan.sc 0.007 -0.826 -0.394
consumerfrac.sc -0.021 0.040 -0.192 -0.052
endothermfrac.sc 0.030 -0.080 -0.254 0.082 -0.140
nspp.sc -0.069 -0.191 0.010 0.181 -0.017 0.162
npp.sc -0.244 -0.032 0.036 0.026 -0.001 -0.170 -0.200
veg.sc 0.008 0.020 0.024 -0.022 -0.008 0.077 0.019 -0.205
temptrend_abs.sc:REALMMarine -0.054 -0.038 -0.001 0.042 -0.024 0.014 0.084 0.016
temptrend_abs.sc:REALMTerrestrial 0.027 -0.055 0.024 0.053 -0.133 0.087 0.111 -0.076
temptrend_abs.sc:tsign1 -0.029 -0.014 0.021 0.018 -0.014 0.004 0.011 -0.034
temptrend_abs.sc:tempave.sc 0.058 0.035 -0.050 0.014 -0.031 -0.323 -0.030 0.139
temptrend_abs.sc:tempave_metab.sc -0.014 0.272 0.106 -0.359 0.069 0.354 0.007 -0.142
temptrend_abs.sc:seas.sc -0.074 -0.002 -0.026 -0.028 0.096 -0.041 0.035 0.126
temptrend_abs.sc:microclim.sc -0.723 0.006 -0.030 -0.008 0.005 -0.001 0.044 0.181
temptrend_abs.sc:mass.sc 0.006 -0.592 -0.064 0.495 -0.032 0.051 0.108 -0.011
temptrend_abs.sc:speed.sc -0.029 -0.071 -0.584 0.197 0.124 0.134 -0.048 -0.011
veg.sc t_.:REALMM t_.:REALMT tm_.:1 tmptrnd_bs.sc:t.
temptrend_abs.sc
REALMMarine
REALMTerrestrial
tsign1
tempave.sc
tempave_metab.sc
seas.sc
microclim.sc
mass.sc
speed.sc
lifespan.sc
consumerfrac.sc
endothermfrac.sc
nspp.sc
npp.sc
veg.sc
temptrend_abs.sc:REALMMarine -0.335
temptrend_abs.sc:REALMTerrestrial 0.027 0.639
temptrend_abs.sc:tsign1 -0.007 0.041 0.005
temptrend_abs.sc:tempave.sc -0.111 0.050 0.024 -0.107
temptrend_abs.sc:tempave_metab.sc 0.066 -0.035 -0.081 0.036 -0.503
temptrend_abs.sc:seas.sc -0.102 0.130 -0.222 -0.034 0.156
temptrend_abs.sc:microclim.sc 0.020 0.073 -0.048 0.027 -0.108
temptrend_abs.sc:mass.sc -0.003 0.043 0.083 0.023 -0.073
temptrend_abs.sc:speed.sc -0.032 0.003 -0.024 -0.010 0.106
tm_.:_. tmptrnd_bs.sc:ss. tmptrnd_bs.sc:mc.
temptrend_abs.sc
REALMMarine
REALMTerrestrial
tsign1
tempave.sc
tempave_metab.sc
seas.sc
microclim.sc
mass.sc
speed.sc
lifespan.sc
consumerfrac.sc
endothermfrac.sc
nspp.sc
npp.sc
veg.sc
temptrend_abs.sc:REALMMarine
temptrend_abs.sc:REALMTerrestrial
temptrend_abs.sc:tsign1
temptrend_abs.sc:tempave.sc
temptrend_abs.sc:tempave_metab.sc
temptrend_abs.sc:seas.sc 0.012
temptrend_abs.sc:microclim.sc 0.092 0.098
temptrend_abs.sc:mass.sc -0.471 -0.025 -0.024
temptrend_abs.sc:speed.sc -0.253 0.062 0.033
tmptrnd_bs.sc:ms. tmptrnd_bs.sc:sp. tmptrnd_bs.sc:l.
temptrend_abs.sc
REALMMarine
REALMTerrestrial
tsign1
tempave.sc
tempave_metab.sc
seas.sc
microclim.sc
mass.sc
speed.sc
lifespan.sc
consumerfrac.sc
endothermfrac.sc
nspp.sc
npp.sc
veg.sc
temptrend_abs.sc:REALMMarine
temptrend_abs.sc:REALMTerrestrial
temptrend_abs.sc:tsign1
temptrend_abs.sc:tempave.sc
temptrend_abs.sc:tempave_metab.sc
temptrend_abs.sc:seas.sc
temptrend_abs.sc:microclim.sc
temptrend_abs.sc:mass.sc
temptrend_abs.sc:speed.sc 0.125
tmptrnd_bs.sc:c. tmptrnd_bs.sc:nd. tmptrnd_bs.sc:ns.
temptrend_abs.sc
REALMMarine
REALMTerrestrial
tsign1
tempave.sc
tempave_metab.sc
seas.sc
microclim.sc
mass.sc
speed.sc
lifespan.sc
consumerfrac.sc
endothermfrac.sc
nspp.sc
npp.sc
veg.sc
temptrend_abs.sc:REALMMarine
temptrend_abs.sc:REALMTerrestrial
temptrend_abs.sc:tsign1
temptrend_abs.sc:tempave.sc
temptrend_abs.sc:tempave_metab.sc
temptrend_abs.sc:seas.sc
temptrend_abs.sc:microclim.sc
temptrend_abs.sc:mass.sc
temptrend_abs.sc:speed.sc
t-1:_. ts1:_. tmptrnd_bs.sc:np. tmptrnd_bs.sc:v.
temptrend_abs.sc
REALMMarine
REALMTerrestrial
tsign1
tempave.sc
tempave_metab.sc
seas.sc
microclim.sc
mass.sc
speed.sc
lifespan.sc
consumerfrac.sc
endothermfrac.sc
nspp.sc
npp.sc
veg.sc
temptrend_abs.sc:REALMMarine
temptrend_abs.sc:REALMTerrestrial
temptrend_abs.sc:tsign1
temptrend_abs.sc:tempave.sc
temptrend_abs.sc:tempave_metab.sc
temptrend_abs.sc:seas.sc
temptrend_abs.sc:microclim.sc
temptrend_abs.sc:mass.sc
temptrend_abs.sc:speed.sc
h_.:REALM2T h_.:REALM2M t_.:-1 t_.:1: t_.:_.:REALM2T
temptrend_abs.sc
REALMMarine
REALMTerrestrial
tsign1
tempave.sc
tempave_metab.sc
seas.sc
microclim.sc
mass.sc
speed.sc
lifespan.sc
consumerfrac.sc
endothermfrac.sc
nspp.sc
npp.sc
veg.sc
temptrend_abs.sc:REALMMarine
temptrend_abs.sc:REALMTerrestrial
temptrend_abs.sc:tsign1
temptrend_abs.sc:tempave.sc
temptrend_abs.sc:tempave_metab.sc
temptrend_abs.sc:seas.sc
temptrend_abs.sc:microclim.sc
temptrend_abs.sc:mass.sc
temptrend_abs.sc:speed.sc
[ reached getOption("max.print") -- omitted 14 rows ]
Standardized Within-Group Residuals:
Min Q1 Med Q3 Max
-5.79037325 -0.27332859 -0.02733247 0.28919907 5.91687491
Number of Observations: 30392
Number of Groups:
STUDY_ID rarefyID %in% STUDY_ID
190 30392
# set up the interactions to plot
ints <- data.frame(vars = c('tsign', 'tempave', 'tempave_metab', 'seas', 'microclim', 'mass', 'speed', 'lifespan', 'consumerfrac', 'endothermfrac', 'nspp', 'thermal_bias', 'npp', 'veg', 'human_bowler', 'human_bowler'),
min = c(1, -10, 10, 0.1, 0, 0, 0, 0.3, 0, 0, 0.3, -10, 1.9, 0, 0, 0),
max = c(2, 30, 40, 16, 6, 8, 2, 2, 1, 1, 2.6, 10, 3.7, 1, 9, 9),
log = c(F, F, F, F, F, T, T, T, F, F, T, F, T, F, F, F),
len = c(2, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100),
discrete = c(T, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F),
REALM = c(rep('Freshwater', 15), 'Marine'),
REALM2 = c(rep('TerrFresh', 15), 'Marine'),
stringsAsFactors = FALSE)
basetab <- data.frame(tempave.sc = 0, tempave_metab.sc = 0,
seas.sc = 0, microclim.sc = 0, mass.sc = 0,
speed.sc = 0, lifespan.sc = 0, endothermfrac.sc = 0,
nspp.sc = 0, thermal_bias.sc = 0, npp.sc = 0, human_bowler.sc = 0, veg.sc = 0,
consumerfrac.sc = 0,
nyrBT = 20, STUDY_ID = 127L, rarefyID = '127_514668')
# make the data frames for each interaction to plot
for(j in 1:nrow(ints)){
# set up a grid of temperature trends and the interacting variable
if(ints$log[j]) intvars <- list(temptrend = seq(-1.5, 1.5, length.out = 100),
new = 10^seq(ints$min[j], ints$max[j], length.out = ints$len[j]),
var = ints$vars[j])
if(!ints$log[j]) intvars <- list(temptrend = seq(-1.5, 1.5, length.out = 100),
new = seq(ints$min[j], ints$max[j], length.out = ints$len[j]),
var = ints$vars[j])
names(intvars) <- c('temptrend', ints$vars[j], 'var')
thisdat <- expand.grid(intvars)
# scale the interacting variable
cent <- attr(trends[[paste0(ints$var[j], '.sc')]], 'scaled:center')
scl <- attr(trends[[paste0(ints$var[j], '.sc')]], 'scaled:scale')
if(!is.null(cent) & !is.null(scl)){
if(ints$log[j]) thisdat[[paste0(ints$var[j], '.sc')]] <- (log(thisdat[[ints$var[j]]]) - cent)/scl
if(!ints$log[j]) thisdat[[paste0(ints$var[j], '.sc')]] <- (thisdat[[ints$var[j]]] - cent)/scl
}
# merge with the rest of the columns
if(ints$var[j] != 'tsign') colnamestouse <- setdiff(colnames(basetab), paste0(ints$var[j], '.sc'))
if(ints$var[j] == 'tsign') colnamestouse <- setdiff(colnames(basetab), ints$var[j])
thisdat <- cbind(thisdat, basetab[, colnamestouse])
# add realm
thisdat$REALM <- ints$REALM[j]
thisdat$REALM2 <- ints$REALM2[j]
# merge with the previous iterations
if(j == 1) newdat <- thisdat
if(j > 1){
colstoadd <- setdiff(colnames(thisdat), colnames(newdat))
for(toadd in colstoadd){
newdat[[toadd]] <- NA
}
colstoadd2 <- setdiff(colnames(newdat), colnames(thisdat))
for(toadd in colstoadd2){
thisdat[[toadd]] <- NA
}
newdat <- rbind(newdat, thisdat)
}
}
# character so that new levels can be added
newdat$REALM <- as.character(newdat$REALM)
newdat$REALM2 <- as.character(newdat$REALM2)
# add extra rows so that all factor levels are represented (for predict.lme to work)
newdat <- rbind(newdat[1:4, ], newdat)
newdat$REALM[1:4] <- c('Marine', 'Marine', 'Terrestrial', 'Terrestrial')
newdat$REALM2[1:4] <- c('Marine', 'Marine', 'TerrFresh', 'TerrFresh')
newdat$temptrend[1:4] <- c(-1, 1, -1, 1)
# trim to at least some temperature change (so that tsign is -1 or 1)
newdat <- newdat[newdat$temptrend != 0,]
# scale the temperature vars
newdat$temptrend.sc <- newdat$temptrend/attr(trends$temptrend.sc, 'scaled:scale')
newdat$temptrend_abs <- abs(newdat$temptrend)
newdat$temptrend_abs.sc <- (newdat$temptrend_abs)/attr(trends$temptrend_abs.sc, 'scaled:scale')
newdat$tsign <- factor(sign(newdat$temptrend))
# make predictions
newdat$preds <- predict(object = modTfull1, newdata = newdat, level = 0)
#remove the extra rows
newdat <- newdat[5:nrow(newdat), ]
# prep the plots
intplots <- vector('list', nrow(ints))
for(j in 1:length(intplots)){
subs <- newdat$var == ints$vars[j] & newdat$temptrend > 0 # select warming side
xvar <- 'temptrend_abs'
title <- ints$vars[j]
if(ints$vars[j] %in% c('tsign')){
subs <- newdat$var == ints$vars[j]
}
if(ints$vars[j] %in% c('thermal_bias')){
subs <- newdat$var == ints$vars[j]
xvar <- 'temptrend'
}
if(ints$vars[j] %in% c('human_bowler')){
subs <- newdat$var == ints$vars[j] & newdat$temptrend > 0 & newdat$REALM2 == ints$REALM2[j]
title <- paste0('human:', ints$REALM2[j])
}
thisplot <- ggplot(newdat[subs, ],
aes_string(x = xvar, y = 'preds',
group = ints$vars[j],
color = ints$vars[j])) +
geom_line() +
coord_cartesian(ylim = c(0, 1)) +
theme(plot.margin = unit(c(0.5,0,0.5,0), 'cm')) +
labs(title = title)
if(ints$log[j] & !ints$discrete[j]){
intplots[[j]] <- thisplot + scale_color_distiller(palette = "YlGnBu", trans = 'log')
}
if(!ints$log[j] & !ints$discrete[j]){
intplots[[j]] <- thisplot + scale_color_distiller(palette = "YlGnBu", trans = 'identity')
}
if(ints$discrete[j]){
intplots[[j]] <- thisplot + scale_color_brewer(palette = "Dark2")
}
}
#grid.arrange(grobs = intplots, '+', theme(plot.margin = unit(c(0,0,0,0), 'cm'))), ncol=2)
#do.call('grid.arrange', c(intplots, ncol = 2))
grid.arrange(grobs = intplots, ncol = 3)
Positive thermal bias means that the species in the assemblage have warmer thermal niches than the environment (and vice versa).
# set up the interactions to plot
ints <- data.frame(vars = c('tsign', 'tempave', 'tempave_metab', 'seas', 'microclim', 'mass', 'speed', 'lifespan', 'consumerfrac', 'endothermfrac', 'nspp', 'thermal_bias', 'npp', 'veg', 'human_bowler', 'human_bowler'),
min = c(1, -10, 10, 0.1, 0, 0, 0, 0.3, 0, 0, 0.3, -10, 1.9, 0, 0, 0),
max = c(2, 30, 40, 16, 6, 8, 2, 2, 1, 1, 2.6, 10, 3.7, 1, 9, 9),
log = c(F, F, F, F, F, T, T, T, F, F, T, F, T, F, F, F),
len = c(2, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100),
discrete = c(T, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F),
REALM = c(rep('Freshwater', 15), 'Marine'),
REALM2 = c(rep('TerrFresh', 15), 'Marine'),
stringsAsFactors = FALSE)
basetab <- data.frame(tempave.sc = 0, tempave_metab.sc = 0,
seas.sc = 0, microclim.sc = 0, mass.sc = 0,
speed.sc = 0, lifespan.sc = 0, endothermfrac.sc = 0,
nspp.sc = 0, thermal_bias.sc = 0, npp.sc = 0, human_bowler.sc = 0, veg.sc = 0,
consumerfrac.sc = 0,
nyrBT = 20, STUDY_ID = 127L, rarefyID = '127_514668')
# make the data frames for each interaction to plot
for(j in 1:nrow(ints)){
# set up a grid of temperature trends and the interacting variable
if(ints$log[j]) intvars <- list(temptrend = seq(-1.5, 1.5, length.out = 100),
new = 10^seq(ints$min[j], ints$max[j], length.out = ints$len[j]),
var = ints$vars[j])
if(!ints$log[j]) intvars <- list(temptrend = seq(-1.5, 1.5, length.out = 100),
new = seq(ints$min[j], ints$max[j], length.out = ints$len[j]),
var = ints$vars[j])
names(intvars) <- c('temptrend', ints$vars[j], 'var')
thisdat <- expand.grid(intvars)
# scale the interacting variable
cent <- attr(trends[[paste0(ints$var[j], '.sc')]], 'scaled:center')
scl <- attr(trends[[paste0(ints$var[j], '.sc')]], 'scaled:scale')
if(!is.null(cent) & !is.null(scl)){
if(ints$log[j]) thisdat[[paste0(ints$var[j], '.sc')]] <- (log(thisdat[[ints$var[j]]]) - cent)/scl
if(!ints$log[j]) thisdat[[paste0(ints$var[j], '.sc')]] <- (thisdat[[ints$var[j]]] - cent)/scl
}
# merge with the rest of the columns
if(ints$var[j] != 'tsign') colnamestouse <- setdiff(colnames(basetab), paste0(ints$var[j], '.sc'))
if(ints$var[j] == 'tsign') colnamestouse <- setdiff(colnames(basetab), ints$var[j])
thisdat <- cbind(thisdat, basetab[, colnamestouse])
# add realm
thisdat$REALM <- ints$REALM[j]
thisdat$REALM2 <- ints$REALM2[j]
# merge with the previous iterations
if(j == 1) newdat <- thisdat
if(j > 1){
colstoadd <- setdiff(colnames(thisdat), colnames(newdat))
for(toadd in colstoadd){
newdat[[toadd]] <- NA
}
colstoadd2 <- setdiff(colnames(newdat), colnames(thisdat))
for(toadd in colstoadd2){
thisdat[[toadd]] <- NA
}
newdat <- rbind(newdat, thisdat)
}
}
# character so that new levels can be added
newdat$REALM <- as.character(newdat$REALM)
newdat$REALM2 <- as.character(newdat$REALM2)
# add extra rows so that all factor levels are represented (for predict.lme to work)
newdat <- rbind(newdat[1:4, ], newdat)
newdat$REALM[1:4] <- c('Marine', 'Marine', 'Terrestrial', 'Terrestrial')
newdat$REALM2[1:4] <- c('Marine', 'Marine', 'TerrFresh', 'TerrFresh')
newdat$temptrend[1:4] <- c(-1, 1, -1, 1)
# trim to at least some temperature change (so that tsign is -1 or 1)
newdat <- newdat[newdat$temptrend != 0,]
# scale the temperature vars
newdat$temptrend.sc <- newdat$temptrend/attr(trends$temptrend.sc, 'scaled:scale')
newdat$temptrend_abs <- abs(newdat$temptrend)
newdat$temptrend_abs.sc <- (newdat$temptrend_abs)/attr(trends$temptrend_abs.sc, 'scaled:scale')
newdat$tsign <- factor(sign(newdat$temptrend))
# make predictions
newdat$preds <- predict(object = modTfullrem0, newdata = newdat, level = 0)
#remove the extra rows
newdat <- newdat[5:nrow(newdat), ]
# prep the plots
intplots <- vector('list', nrow(ints))
for(j in 1:length(intplots)){
subs <- newdat$var == ints$vars[j] & newdat$temptrend > 0 # select warming side
xvar <- 'temptrend_abs'
title <- ints$vars[j]
if(ints$vars[j] %in% c('tsign')){
subs <- newdat$var == ints$vars[j]
}
if(ints$vars[j] %in% c('thermal_bias')){
subs <- newdat$var == ints$vars[j]
xvar <- 'temptrend'
}
if(ints$vars[j] %in% c('human_bowler')){
subs <- newdat$var == ints$vars[j] & newdat$temptrend > 0 & newdat$REALM2 == ints$REALM2[j]
title <- paste0('human:', ints$REALM2[j])
}
thisplot <- ggplot(newdat[subs, ],
aes_string(x = xvar, y = 'preds',
group = ints$vars[j],
color = ints$vars[j])) +
geom_line() +
coord_cartesian(ylim = c(-0.6, 0.6)) +
theme(plot.margin = unit(c(0.5,0,0.5,0), 'cm')) +
labs(title = title)
if(ints$log[j] & !ints$discrete[j]){
intplots[[j]] <- thisplot + scale_color_distiller(palette = "YlGnBu", trans = 'log')
}
if(!ints$log[j] & !ints$discrete[j]){
intplots[[j]] <- thisplot + scale_color_distiller(palette = "YlGnBu", trans = 'identity')
}
if(ints$discrete[j]){
intplots[[j]] <- thisplot + scale_color_brewer(palette = "Dark2")
}
}
#grid.arrange(grobs = intplots, '+', theme(plot.margin = unit(c(0,0,0,0), 'cm'))), ncol=2)
#do.call('grid.arrange', c(intplots, ncol = 2))
grid.arrange(grobs = intplots, ncol = 3)
resids <- resid(modTfull1)
preds <- getData(modTfull1)
col = '#00000033'
cex = 0.5
par(mfrow = c(5,4))
boxplot(resids ~ preds$REALM, cex = cex, col = col)
plot(preds$temptrend_abs.sc, resids, cex = cex, col = col)
plot(preds$tsign, resids, cex = cex, col = col)
plot(preds$tempave.sc, resids, cex = cex, col = col)
plot(preds$tempave_metab.sc, resids, cex = cex, col = col)
plot(preds$seas.sc, resids, cex = cex, col = col)
plot(preds$microclim.sc, resids, cex = cex, col = col)
plot(preds$mass.sc, resids, cex = cex, col = col)
plot(preds$speed.sc, resids, cex = cex, col = col)
plot(preds$lifespan.sc, resids, cex = cex, col = col)
plot(preds$consumerfrac.sc, resids, cex = cex, col = col)
plot(preds$endothermfrac.sc, resids, cex = cex, col = col)
plot(preds$nspp.sc, resids, cex = cex, col = col)
plot(preds$thermal_bias.sc, resids, cex = cex, col = col)
plot(preds$npp.sc, resids, cex = cex, col = col)
plot(preds$veg.sc, resids, cex = cex, col = col)
plot(preds$human_bowler.sc, resids, cex = cex, col = col)
if(file.exists('output/aics_from_full.csv')){
aicsfromfull <- read.csv('output/aics_from_full.csv')
if(all(c('dAIC_Jbeta', 'dAIC_Horn') %in% colnames(aicsfromfull))){
runJbetaHorn <- FALSE
} else {
runJbetaHorn <- TRUE
}
} else {
runJbetaHorn <- TRUE
}
if(runJbetaHorn){
i <- trends[, complete.cases(Jbetatrend, REALM, tempave.sc, tempave_metab.sc, seas.sc, microclim.sc,
temptrend_abs.sc, mass.sc, speed.sc, lifespan.sc,
consumerfrac.sc, endothermfrac.sc, nspp.sc, thermal_bias.sc, npp.sc, veg.sc, human_bowler.sc)]
i2 <- trends[, complete.cases(Horntrend, REALM, tempave.sc, tempave_metab.sc, seas.sc, microclim.sc,
temptrend_abs.sc, mass.sc, speed.sc, lifespan.sc,
consumerfrac.sc, endothermfrac.sc, nspp.sc, thermal_bias.sc, npp.sc, veg.sc, human_bowler.sc)]
randef <- list(STUDY_ID = ~ temptrend_abs.sc, rarefyID = ~1)
varef <- varPower(-0.5, ~nyrBT)
terms <- c('temptrend_abs.sc*REALM',
'temptrend_abs.sc*tsign',
'temptrend_abs.sc*tempave.sc',
'temptrend_abs.sc*tempave_metab.sc',
'temptrend_abs.sc*seas.sc',
'temptrend_abs.sc*microclim.sc',
'temptrend_abs.sc*mass.sc',
'temptrend_abs.sc*speed.sc',
'temptrend_abs.sc*lifespan.sc',
'temptrend_abs.sc*consumerfrac.sc',
'temptrend_abs.sc*endothermfrac.sc',
'temptrend_abs.sc*nspp.sc',
'temptrend_abs.sc*thermal_bias.sc:tsign',
'temptrend_abs.sc*npp.sc',
'temptrend_abs.sc*veg.sc',
'temptrend_abs.sc*human_bowler.sc:REALM2')
modTJbetadrops <- vector('list', length(terms)+2)
modTHorndrops <- vector('list', length(terms)+2)
names(modTJbetadrops) <- c('full', '-temptrend_abs.sc', paste0('-', terms))
names(modTHorndrops) <- c('full', '-temptrend_abs.sc', paste0('-', terms))
# fit full model with ML for model comparison
modTJbetadrops[[1]] <- lme(formula(paste0('Jbetatrend ~ ', paste(terms, collapse = ' + '))),
random = randef, weights = varef, data = trends[i,], method = 'ML')
modTHorndrops[[1]] <- lme(formula(paste0('Horntrend ~ ', paste(terms, collapse = ' + '))),
random = randef, weights = varef, data = trends[i2,], method = 'ML')
# w/out temptrend
modTJbetadrops[[2]] <- lme(formula(paste0('Jbetatrend ~ ', paste(gsub('temptrend_abs.sc\\*', '', terms), collapse = ' + '))),
random = list(STUDY_ID = ~ 1, rarefyID = ~1), weights = varef, data = trends[i,], method = 'ML')
modTHorndrops[[2]] <- lme(formula(paste0('Horntrend ~ ', paste(gsub('temptrend_abs.sc\\*', '', terms), collapse = ' + '))),
random = list(STUDY_ID = ~ 1, rarefyID = ~1), weights = varef, data = trends[i2,], method = 'ML')
for(j in 1:length(terms)){
print(j)
modTJbetadrops[[j+2]] <- lme(formula(paste0('Jbetatrend ~ ', paste(terms[-j], collapse = ' + '))),
random = randef, weights = varef, data = trends[i,], method = 'ML',
control = lmeContrl(returnObject = TRUE)) # return fitted object even if a convergence error
modTHorndrops[[j+2]] <- lme(formula(paste0('Horntrend ~ ', paste(terms[-j], collapse = ' + '))),
random = randef, weights = varef, data = trends[i2,], method = 'ML')
}
aicsJbeta <- sapply(modTJbetadrops, AIC)
aicsHorn <- sapply(modTHorndrops, AIC)
if(exists('aicsfromfull')){
aicsfromfull$dAIC_Jbeta <- aicsJbeta - aicsJbeta[1]
aicsfromfull$dAIC_Horn <- aicsHorn - aicsHorn[1]
} else {
aicsfromfull <- data.frame(mod = names(aics),
dAIC_Jbeta = aicsJbeta - aicsJbeta[1],
dAIC_Horn <- aicsHorn - aicsHorn[1])
}
write.csv(aicsfromfull, file = 'output/aics_from_full.csv', row.names = FALSE)
}
aicsfromfull
# transform for a plot
aicsfromfulllong <- reshape(aicsfromfull, direction = 'long',
varying = c('dAIC_Jtu', 'dAIC_Jbeta', 'dAIC_Horn'),
v.names = 'dAIC',
idvar = 'mod',
timevar = 'type',
times = c('Jtu', 'Jbeta', 'Horn'))
trans = function(x) sign(x)*sqrt(abs(x))
aicsfromfulllong$dAIC_tr <- trans(aicsfromfulllong$dAIC)
# plot
xlims <- range(aicsfromfulllong$dAIC_tr)
xticks <- c(-10, 0, 10, 100, 1000, 10000)
par(mai = c(0.5, 3, 0.1, 0.1))
with(aicsfromfulllong[aicsfromfulllong$type == 'Jtu',], plot(dAIC_tr, nrow(aicsfromfull):1,
col = 'light grey', xlim = xlims, yaxt = 'n', ylab = '', xaxt = 'n'))
with(aicsfromfulllong[aicsfromfulllong$type == 'Jbeta',], points(dAIC_tr, nrow(aicsfromfull):1 - 0.1, col = 'dark grey'))
with(aicsfromfulllong[aicsfromfulllong$type == 'Horn',], points(dAIC_tr, nrow(aicsfromfull):1 - 0.2, col = 'black'))
axis(2, at = nrow(aicsfromfull):1, labels = aicsfromfull$mod, las = 1, cex.axis = 0.7)
axis(1, at = trans(xticks), labels = xticks, cex.axis = 0.5)
abline(v = 0, lty =2, col = 'grey')
Light grey is for Jaccard turnover, dark grey is for Jaccard total, black is for Morisita-Horn
# fig.width = 3, fig.height = 5, out.height=2.5, out.width=3, fig.retina =3 for macbook screen
# double that for external monitor
coefs <- as.data.table(summary(modTfull1)$tTable)
coefs2 <- as.data.table(summary(modTfullJbeta)$tTable)
coefs3 <- as.data.table(summary(modTfullHorn)$tTable)
coefs4 <- as.data.table(summary(modTfullrem0)$tTable)
coefs5 <- as.data.table(summary(modTfullJbetarem0)$tTable)
coefs6 <- as.data.table(summary(modTfullHornrem0)$tTable)
coefs$mod <- 'Jtu'
coefs2$mod <- 'Jbeta'
coefs3$mod <- 'Horn'
coefs4$mod <- 'Jtu rem0'
coefs5$mod <- 'Jbeta rem0'
coefs6$mod <- 'Horn rem0'
coefs$var <- rownames(summary(modTfull1)$tTable)
coefs2$var <- rownames(summary(modTfullJbeta)$tTable)
coefs3$var <- rownames(summary(modTfullHorn)$tTable)
coefs4$var <- rownames(summary(modTfullrem0)$tTable)
coefs5$var <- rownames(summary(modTfullJbetarem0)$tTable)
coefs6$var <- rownames(summary(modTfullHornrem0)$tTable)
# extract temperature effects and bind model coefs together
cols <- c('var', 'Value', 'Std.Error', 'mod')
allcoefsfull <- rbind(coefs[grep('temptrend|REALM', var), ..cols],
coefs2[grep('temptrend|REALM', var), ..cols],
coefs3[grep('temptrend|REALM', var), ..cols],
coefs4[grep('temptrend|REALM', var), ..cols],
coefs5[grep('temptrend|REALM', var), ..cols],
coefs6[grep('temptrend|REALM', var), ..cols])
allcoefsfull$var[allcoefsfull$var == 'temptrend_abs.sc'] <- 'temptrend_abs.sc:REALMFreshwater'
# add average temperature effect (across realms) to realm-specific temperature effects
meantempeffect <- allcoefsfull[var == 'temptrend_abs.sc:REALMFreshwater', mean(Value), by = mod]$V1
allcoefsfull[var == 'temptrend_abs.sc:REALMMarine', Value := Value + meantempeffect]
allcoefsfull[var == 'temptrend_abs.sc:REALMTerrestrial', Value := Value + meantempeffect]
# remove non-temperature effects
allcoefsfull <- allcoefsfull[grepl(':', allcoefsfull$var) & grepl('temptrend', allcoefsfull$var), ]
# add info for plotting
allcoefsfull$lCI <- allcoefsfull$Value - allcoefsfull$Std.Error # lower confidence interval
allcoefsfull$uCI <- allcoefsfull$Value + allcoefsfull$Std.Error
nvar <- nrow(allcoefsfull)/3
allcoefsfull$y <- 1:nvar + rep(c(0, 0.1, 0.2), c(nvar, nvar, nvar)) # y-values
# clean up some variable names for nicer plotting
allcoefsfull$varname <- gsub('temptrend_abs.sc:|temptrend.sc:', '', allcoefsfull$var)
allcoefsfull$varname <- gsub('REALM|REALM2', '', allcoefsfull$varname)
allcoefsfull$varname <- gsub('.sc', '', allcoefsfull$varname)
allcoefsfull$varname <- gsub('_bowler', '', allcoefsfull$varname)
allcoefsfull$varname <- gsub('tsign1', 'warming', allcoefsfull$varname)
allcoefsfull$varname <- gsub('tsign-1', 'cooling', allcoefsfull$varname)
# set x-axes
xlims1 <- c(-0.01, 0.11) # for realms
xlims2 <- c(-0.05, 0.05) # for traits
xlims3 <- c(-0.01, 0.02) # for environment
xlims4 <- c(-0.016, 0.01) # for community
xlims5 <- c(-0.006, 0.005) # for human
ddg <- 0.5 # vertical dodge for each model
# choose which variables are in which graph
set1 <- c('Terrestrial', 'Marine', 'Freshwater')
set2 <- c('mass', 'speed', 'lifespan', 'consumerfrac', 'endothermfrac', 'tempave_metab')
set3 <- c('seas', 'microclim', 'tempave')
set4 <- c('npp', 'nspp', 'tsign-1:thermal_bias', 'tsign1:thermal_bias')
set5 <- c('human:TerrFresh', 'human:Marine')
p1 <- ggplot(subset(allcoefsfull, varname %in% set1),
aes(varname, Value, group = mod, color = mod)) +
geom_hline(yintercept = 0, linetype = 'dashed', color = 'light grey') +
geom_errorbar(aes(ymin = lCI, ymax = uCI), width = 0, position = position_dodge(ddg)) +
geom_point(position = position_dodge(ddg)) +
labs(y = 'Temperature change effect', x = '', tag = 'A') +
scale_color_brewer(palette = 'Dark2') +
theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(),
panel.background = element_blank(), axis.line = element_line(colour = "black"),
legend.position='none',
axis.text=element_text(size=7),
axis.title=element_text(size=7)) +
coord_flip(ylim = xlims1)
p2 <- ggplot(subset(allcoefsfull, varname %in% set2),
aes(varname, Value, group = mod, color = mod)) +
geom_hline(yintercept = 0, linetype = 'dashed', color = 'light grey') +
geom_errorbar(aes(ymin = lCI, ymax = uCI), width = 0, position = position_dodge(ddg)) +
geom_point(position = position_dodge(ddg)) +
labs(y = 'Interaction with temperature change effect', x = '', tag = 'B') +
scale_color_brewer(palette = 'Dark2') +
theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(),
panel.background = element_blank(), axis.line = element_line(colour = "black"),
legend.position='none',
axis.text=element_text(size=7),
axis.title=element_text(size=7)) +
coord_flip(ylim = xlims2)
p3 <- ggplot(subset(allcoefsfull, varname %in% set3),
aes(varname, Value, group = mod, color = mod)) +
geom_hline(yintercept = 0, linetype = 'dashed', color = 'light grey') +
geom_errorbar(aes(ymin = lCI, ymax = uCI), width = 0, position = position_dodge(ddg)) +
geom_point(position = position_dodge(ddg)) +
labs(y = 'Interaction with temperature change effect', x = '', tag = 'C') +
scale_color_brewer(palette = 'Dark2') +
theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(),
panel.background = element_blank(), axis.line = element_line(colour = "black"),
legend.position='none',
axis.text=element_text(size=7),
axis.title=element_text(size=7)) +
coord_flip(ylim = xlims3)
p4 <- ggplot(subset(allcoefsfull, varname %in% set4),
aes(varname, Value, group = mod, color = mod)) +
geom_hline(yintercept = 0, linetype = 'dashed', color = 'light grey') +
geom_errorbar(aes(ymin = lCI, ymax = uCI), width = 0, position = position_dodge(ddg)) +
geom_point(position = position_dodge(ddg)) +
labs(y = 'Interaction with temperature change effect', x = '', tag = 'D') +
scale_color_brewer(palette = 'Dark2') +
theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(),
panel.background = element_blank(), axis.line = element_line(colour = "black"),
legend.position='none',
axis.text=element_text(size=7),
axis.title=element_text(size=7)) +
coord_flip(ylim = xlims4)
p5 <- ggplot(subset(allcoefsfull, varname %in% set5),
aes(varname, Value, group = mod, color = mod)) +
geom_hline(yintercept = 0, linetype = 'dashed', color = 'light grey') +
geom_errorbar(aes(ymin = lCI, ymax = uCI), width = 0, position = position_dodge(ddg)) +
geom_point(position = position_dodge(ddg)) +
labs(y = 'Interaction with temperature change effect', x = '', tag = 'E') +
scale_color_brewer(palette = 'Dark2') +
theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(),
panel.background = element_blank(), axis.line = element_line(colour = "black"),
legend.position='bottom',
axis.text=element_text(size=7),
axis.title=element_text(size=7)) +
coord_flip(ylim = xlims5)
grid.arrange(p1, p2, p3, p4, p5, ncol = 2, layout_matrix = rbind(c(1,2), c(3,4), c(5, NA)))
NA
NA